All Linux HowTo's Security HowTo's

Reset a lost MySQL Password on CentOS and Redhat Linux

Use these instructions to reset a lost MySQL root password. I’ve taken these steps from the website “http://www.rackspace.com/knowledge_center/article/mysql-resetting-a-lost-mysql-root-password”. All credit to them. Note that this is done as the ‘root’ user.

First stop MySQL and start it in ‘safe mode’:

service mysqld stop
mysqld_safe --skip-grant-tables &

Now login without the password and reset it:

mysql -u root
use mysql;
update user set password=PASSWORD("HappyPassword99") where User='root';
flush privileges;
quit

Now restart MySQL:

service mysqld restart
mysql -u root -p

And we’re done.

Similar Posts:

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.