Go2Linux | Linux Operating System

A site dedicated to: Linux Operating System

mysql root password recovery

Date: 2007-08-07 00:00:00 -0400

If you ever loose your mysql root password (remember is not the same as the system root password) you can recover it following this steps

Start MySQL in safe mode
mysqld_safe --skip-grant-tables
Enter the console as root
mysql -u root
Set the new password
UPDATE mysql.user SET Password=PASSWORD('new_password') WHERE User='root';
Update the privileges
FLUSH PRIVILEGES;

The mysqld_safe command could be different in your distribution this one is for CentOS, for you could be safe_mysql or just mysql with the --skip-grant-tables option.

If you liked this article please share it.

powered by TinyLetter

If you want to contact me in any other way, please use the contact page.