Mysql : Reset MySQL root password

Published by

Posted on September 21, 2008

If you’ve forgotten the root password for a MySQL server, but you know the system root, you can reset the MySQL root password pretty easily. Just remember to work quickly since the server is wide open until you finish working.

First, add skip-grant-tables to the [mysqld] section of /etc/my.cnf and restart the MySQL server.

Next, run mysql from the command line and use the following SQL statement:

UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';
FLUSH PRIVILEGES;

Remove the skip-grant-tables from /etc/my.cnf and restart the server

 

 

also check out 

http://wiki.mysqltuner.com/MySQLTuner