Reset / Recover MySQL root Password / MySQL / Linux


Perform this Howto to Reset / Recover root password of MySQL.

There are many cases that we used to forget root password of MySQL, So Perform just few steps and you will able to reset root mysql password.


Perform below steps to Recover / Reset MySQL Password.

1. Stop MySQL Service

[root@linux-support-ahmedabad-tejas-barot ~]# /etc/init.d/mysqld stop

2. Execute Following Command

[root@linux-support-ahmedabad-tejas-barot ~]# mysqld_safe --skip-grant-tables and Press ENTER

3. Now Let’s Login to MySQL Without Password


[root@linux-support-ahmedabad-tejas-barot ~]# mysql -u root

4. Use Following Queries to Reset/Change your MySQL root Password

mysql> use mysql;

mysql> update user set password=PASSWORD(“NEW-MYSQL-ROOT-PASSWORD”) where User=’root’;
mysql> flush privileges;
mysql> quit

5. Let’s Stop MySQL Server as we have started in Step 2

[root@linux-support-ahmedabad-tejas-barot ~]# service mysqld stop

6. Now Start MySQL Service for using Databases

[root@linux-support-ahmedabad-tejas-barot ~]# service mysqld start

7. Execute Following Command to Login with New Password 

[root@linux-support-ahmedabad-tejas-barot ~]# mysql -u root -p

Hope this will helps you all, If you face any issue regarding the same or its not working for you some how then please raise your questions / issues at

If you like this then Please Click Google +1 Button and Show Your Support. Your Support will encourage me to write more articles.

All Linux User’s Blog Mobile Applications :-

Please Keep in Touch with Social Networking :- 

Facebook Page :-

Enjoy MySQL :-) Enjoy Linux :-) Enjoy Open Source :-) 

2 thoughts on “Reset / Recover MySQL root Password / MySQL / Linux”

  1. Step1: First we will login to the MYSQL server through the command line by using below command.

    $ mysql –u root –p
    Step 2: After entering above command then enter your current password to complete the login.

    Then switch to appropriate MYSQL database by using below command.

    $ use mysql;
    Step 3: Then use below command to change the MYSQL password.

    $ update user set password=PASSWORD(‘your_new_password’) where User=’root’;
    Note: You can change the password for any user by using above command. Only specify the user’s username in the place of root.

    Step 4:Then reload the privileges by using below command.

    $ flush privileges;

  2. This tutorial explains how you can set, change and reset (if you’ve forgotten the password) MySQL root passwords. Time and again I see problems like mysqladmin: connect to server at ‘localhost’ failed error: ‘Access denied for user ‘root’@’localhost’ (using password: YES)’. So I thought it’s time to remind you how to solve MySQL related password problems. If you are just looking for a quick fix how to reset a MySQL root password you can find that at the bottom of this tutorial.

Leave a Reply

Your email address will not be published. Required fields are marked *