Popular Posts

Saturday, December 31, 2011

How to reset MySQL root password option 2

In my previous posting I explained how to reset MySQL root password using" --init-file"  MySQL start up parameter. Yet there is another option using "--skip-grant-tables" MySQL parameter.

Here is how to do it:

1. Shutdown MySQL using /etc/init.d/mysqld stop

2. Star MySQL using "--skip-grant-tables" parameter

/etc/init.d/mysqld-safe --skip-grant-tables

MySQL is now running in back round since we used (&) option 

3. Now we can reset any password since MySQL is not validating permissions:

Login as root (you will not be prompted for the passoword) and reset MySQL root passwod:
mysql> update user set Password=PASSWORD('whoohoo') WHERE User='root';

 Pretty cool huh, now you can restart MySQL as usual using "/etc/init.d/mysqld restart" and enjoy the changes.

No comments: