Saturday, 10 November 2012

How to reset Mysql root password on linux

First stop the mysql daemon service

   # /etc/init.d/mysqld   stop

Then, run following command in terminal

   # mysqld_safe    --skip-grant-tables   & 

Now login mysql

   # mysql   -u   root   mysql

Change root  password

   mysql >  UPDATE  mysql.user  SET  Password=PASSWORD('MyNewPass') WHERE User='root';

   mysql> FLUSH PRIVILEGES;

   mysql> exit

Now start the mysql daemon service

   # /etc/init.d/mysqld   start

   #  mysql   -u   root   -p

I hope , Now you can able to login with root user.


No comments:

Post a Comment