Reset Mysql Root Password

19 Dec

Have you ever for­got­ten the root pass­word on one of your MySQL servers.

Just follow the below mentioned command to reset.


First things log in as root and stop the mysql dae­mon. Run the below mentioned command in terminal.

#service mysql stop

#mysqld_safe --skip-grant-tables


Now lets start up the mysql dae­mon and skip the grant tables which store the pass­words.

service mysqld start


You should see mysqld start up successfully. Now connect to mysql without a password.

#mysql --user=root mysql


Reset the password.

mysql> update user set Password=PASSWORD('NEWPASSWORD') 
where user='root';

mysql> flush privileges;

mysql> exit;


Now login with password.

#mysql -uroot -pNEWPASSWORD
Leave a comment

Posted by on December 19, 2012 in General, MySQL


Tags: , , , ,

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

%d bloggers like this: