Reset MySQL root password

From Organic Design
Jump to: navigation, search
Procedure.svg Reset MySQL root password
Organic Design procedure

To reset the root password of a MySQL server, first go to a root shell and stop MySQL:

service mysql stop

Next, run MySQL in safe mode in the background:

mysqld_safe --skip-grant-tables &

Reset the MySQL root password:

mysql -u root
use mysql
update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
flush privileges;

And restart the MySQL server again:

service mysql start