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

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>