Categories

Archives

MySQL – Reset Password for `root` User

In case you happen to forget the root password, here is what you do to reset it.

[sql-serv]# service mysqld stop
[sql-serv]# mysqld_safe –skip-grant-tables &

This will start MySQL without asking you for any password. Once started and you’re on MySQL CLI, you can update the root password:

mysql > UPDATE user SET Password=PASSWORD(‘new-password-here’) WHERE User=’root’;
mysql > flush privileges;
mysql > exit

Now you can start MySQL as normal.

service mysqld start

Try to login with your new password

mysql -uroot -pnew-password-here

1 person likes this post.
Unlike