Reset MySQL Password with skip-grant-tables option

Steps to Reset the mysql root password.

Stop the MySQL server process.

/etc/init.d/mysqld stop or /etc/init.d/mysql stop

Start the MySQL server with the –skip-grant-tables option .

mysqld_safe --skip-grant-tables &

Connect to mysql server as the root user.

mysql -u root

Setup new mysql root password for your mysql server.

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

Exit and restart the MySQL server.

/etc/init.d/mysql restart or /etc/init.d/mysqld restart

Now you can access your mysql server with the new mysql root paasword

mysql -uroot -p

Leave a Reply

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.