Reset Forgotten MySQL Root Password


Sunday
21 September, 2014
2206 Hits

Reset Forgotten MySQL Root Password

Oracle Technology

Using MySQL and cannot remember your root password? It is possible your answer is No. Not everyone is perfect and very good at keeping password being used on their system. This article is to enable system administrator to reset the root password of the MySQL database on their system. This is a quick tip on how to reset your MySQL root password. It does require root access on your server. If you have forgotten that password, I just cannot help you.

To change the password, login as root and stop MySQL daemon running on the machine. You can stop that by using the GUI tool on the Linux or you can use the command below:

 

[jamachree@octopus ~]$ su

 

You are required to enter the password and press the Enter key on your keyboard.

To change the password for MySQL, execute the command below:

 

mysqld_safe --skip-grant-tables

 

This will start MySQL daemon (mysqld) successfully and you should be able to connect to MySQL without a password.

To change the password, execute the commands:

 

mysql> update user set password=PASSWORD('NEWPASSWORD') where User='root'; mysql> flush privileges; mysql> quit

 

 

  

This blog's content is intended solely for informational purposes. While every effort is made to ensure accuracy, completeness, and relevance, the information may not be current or applicable in all situations. The opinions expressed are solely those of the author and do not reflect the views of any organization they may be affiliated with.