Reset mysql root password

To reset the mysql root password follow these steps

1. Stop running mysql instances

# service mysqld stop

1a. If that doesn’t work then kill all running mysql instances

# pkill mysql

1. Stop running mysql instances

# service mysqld stop

2. Start Mysql in safe mode

# mysqld_safe --skip-grant-tables

3. Run these command replacing somepassword with your new password

mysql> update mysql.user set Password=PASSWORD('somepassword') where user='root';
mysql> flush privileges;
mysql> exit;

4. Start mysqld again

# service mysqld stop

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.