Reset mysql password without login into it

I had installed phpmyadmin in ubuntu 11.10. But I can’t login into it cause I forgot password of mysql.

After a little search I found the way to reset password without login into it. It need only root access of machine. I just like to share it

Follow the below steps to reset password of  mysql.

1. Stop MySQL Server.
sudo /etc/init.d/mysql stop

2. Start the mysqld configuration.
sudo mysqld –skip-grant-tables &

3. Login to MySQL as root.
mysql -u root mysql

4. Replace NEWPASSWORD with your new password!
UPDATE user SET Password=PASSWORD(‘NEWPASSWORD’) WHERE User=’root’; FLUSH PRIVILEGES;

5.Exit
exit;

Enjoy 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.