How to reset MySql root user password

This article explains the detailed steps to reset the password for MySql root user.

Step1: Stop MySQL service

#/etc/init.d/mysql stop

Step2: Start MySQL server without password

#mysqld_safe --skip-grant-tables &

Step3: Connect to mysql server using mysql client

#mysql -u root

Step4: Setup new password for the user root

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

Step5: Stop MySQL Server:

#/etc/init.d/mysql stop

Step6: Start MySQL server

#/etc/init.d/mysql start

That's all.......

Leave a Reply

Your email address will not be published. Required fields are marked *