DieterHolvoet
3/13/2017 - 2:51 PM

Reset the root password of a MySQL server

Reset the root password of a MySQL server

  1. sudo nano /etc/mysql/my.cnf
  2. Add the following lines at the end: [mysqld] skip-grant-tables
  3. sudo service mysql restart
  4. mysql -u root
  5. UPDATE mysql.user set authentication_string = PASSWORD('your_new_password') where user = 'root' and host = 'localhost';
  6. exit
  7. Remove the lines added in step 2 if you want to keep your security standards.