Reset / Recover MySQL root Password / MySQL / Linux

Hello,

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.

MySQL
MySQL

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 http://linuxforums.tejasbarot.com

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 :- http://www.tejasbarot.com/download-mobile-apps/

Please Keep in Touch with Social Networking :- 

Facebook Page :- https://www.facebook.com/AllLinuxUsersBlog

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

Change root password of MySQL

To Change root Password of mysql you can change it by using

mysqladmin command.

if you want to change or update root password then execute this command

mysqladmin -u root -p’oldpassword’ password newpassword

For example, If old password is tejas, and set new password to tejasbarot, enter:

mysqladmin -u root -p’tejas’ password tejasbarot

if you want to change password of other user of MySQL then execute this command

mysqladmin -u <your-username> -p oldpassword newpass

Enjoy 🙂