Reset mysql password if root password is not known

One of the common issue encountered by server admins while manging mysql is that, the root passwords are unknown. We can reset the root password for getting into the mysql prompt by following the below steps.


Stop mysql service

/etc/init.d/mysql stop

Start to MySQL server w/o password

mysqld_safe --skip-grant-tables &

Connect to mysql server using mysql client

 mysql -u root

Setup new MySQL root user password

mysql> use mysql;
 mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
 mysql> flush privileges;
 mysql> quit

Stop MySQL Server:

/etc/init.d/mysql stop

Start MySQL

/etc/init.d/mysql start


There are no revisions for this post.

Tags: , ,

No comments yet.

Leave a Reply