How to Recover MySQL root Password in Linux?

To Recover MySQL root password in linux follow below steps –

First Stop mysql service.
# /etc/init.d/mysqld stop

Start MySQL server without 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-PASSWORD”) where User=’root’;
mysql> flush privileges;
mysql> quit

Finally restart MySQL Server and test it.
# /etc/init.d/mysqld restart

# mysql -u root -p

Please Post Your Comments & Reviews

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.