13 Aug, 2008  |  Posted by Danesh  |  in HowTo, Linux

It happens, you set a super complicated password for your MySQL root account and 2 months down the road forget what it was.

Here’s how you’d fix that.

1. Stop your current MySQL database if it is running

root@abubu# service mysqld stop

2. Start MySQL in safe mode and bypass reading the privilege table.

root@abubu# mysqld_safe --skip-grant-tables

3. Reset your root password MySQL console. If it goes well you will not need to key in a password.

root@abubu# mysql -u root mysql

mysql> update user set Password=PASSWORD('new-password');
mysql> flush privileges;
mysql exit;

4. Kill the MySQL process and restart MySQL normally.