MySQL reinitialize root password

MySQL reinitialize root password

Posted By: pmietlicki

Published to SQL on Jun 04, 2015

Stop MySQL :

sudo service mysql stop

Relaunch it with option --skip-grant-tables :

mysqld_safe --skip-grant-tables &

Then you can connect without any password :

mysql

Go to the internal database of mysql :

use mysql;

And use this SQL command to reinitialize the password :

update user set password=password('new_password') where user='root';

You can then stop mysql :

service mysql stop

And relaunch it :

service mysql start

Tags: BDD, database, MySQL

Archive