Thursday, August 25, 2011

MySql: how to reset root password

Ensure that all mysql processes are down.
Kill all one by one or use
killall mysqld
and/or
killall mysql
Then create a new file /home/usr_home/reset_root_pwd with the following content

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

Then login a console as mysql user and give the following command:
mysqld_safe --init-file=/home/usr_home/reset_root_pwd &

 
After stop the server and restart it.
Now You should be able to connect as root with the new password.

Bye...

Usefull links: 
- http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
- http://openskill.info/infobox.php?ID=1033


No comments:

Post a Comment