Reset MySQL root Password

If you have forget the mysql root password and you are not able to access your mysql service then you need to reset the password of mysql root user by using following steps
Ans :
1)root@server [~] /etc/init.d/mysqld stop
2) Start to MySQL server without password:
root@server [~] mysqld_safe --skip-grant-tables &
3) root@server [~] mysql
After that you can get the mysql prompt then run the following command
4) mysql >use mysql;
5) mysql >update user set password=PASSWORD("NEWPASSWORD") where User='root';
6) mysql > quit
7) root@server [~] /etc/init.d/mysqld stop
8) root@server [~] /etc/init.d/mysqld start
Now you can access your mysql service by using
[root@server ~]# mysql -u root -p

One Thought to “Reset MySQL root Password”

  1. Hello, Thanks for comment and I want to share more information to client.

Leave a Comment