RSS

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.

Step-1:

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

Step-2:

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

service mysqld start

Step-3:

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

#mysql --user=root mysql

Step-4:

Reset the password.

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

mysql> flush privileges;

mysql> exit;

Step-5:

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:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

 
%d bloggers like this: