Recover MySQL Root Password

To recover the password for the root account on a MySQL server use the following steps…

(Essentially, it can be done by restarting the daemon without the grant tables)

1. Stop the current mysql process

# /etc/init.d/mysql stop

2. Start the daemon without the grant tables

# mysqld_safe —skip-grant-tables &

3. Login to mysql as the root user … it will have a blank password

mysql> use mysql;

mysql> update user set password=PASSWORD(“newPassword”) where User=’root’;

mysql> flush privileges;

mysql> quit

5. Stop & restart the daemon

# /etc/init.d/mysql stop

# /etc/init.d/mysql start

Short URL for this post: http://tmblr.co/ZufQ6y1BLUtX