Reset MySQL Password


August 12, 2012 by harshalvaidya

Resetting MySQL Password

Initially login to server and stop the MySQL service on server. the best practice is to execute


# killall -9 mysqld (before stopping service)

#/etc/init.d/mysqld stop

Once the MySQL process is killed, execute the following command:

#mysqld-safe –skip-grant-tables

This will run the MySQL process so you need to open another terminal to be able to reset the password. On the new terminal, you will now be able to login to MySQL to reset the password.

On the shell prompt of the new terminal, open the MySQL console:


mysql> use mysql; 
mysql> UPDATE user SET Password=PASSWORD(‘YOUR_NEW_PASSWORD’) WHERE Host=’localhost’ AND User=’root’; 
mysql> exit

This will change the password for the user ‘root’. Kill the MySQL process running in the first terminal, and start the mysql services.

#/etc/init.d/mysqld stop

Try logging in to the MySQL console using the new password:

#mysql -uroot -p

You should now be able to use the new password for your MySQL.




2 thoughts on “Reset MySQL Password

  1. You made some clear points there. I did a search on the subject and found most individuals will consent with your site.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog Stats

  • 777 hits


var infolink_pid = 1084591; var infolink_wsid = 0;
%d bloggers like this: