Jul 15, 2010

How to recover a MySQL database with lost root password

I couldn't remember the root password I set for testing on my mysql database.
There is a recipe for recovering the database:

Start the databse with the option --skip-grant-tables an log in with mysql.
Because of the option you're not asked for a password.

Set a new password with


update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';

and restart the database.

see  http://www.cyberciti.biz/tips/recover-mysql-root-password.html for the
full description.