All HowTo's Cyber-Security Linux MySQL & MariaDB Redhat, Fedora and CentOS Linux

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 “”. 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;

Now restart MySQL:

service mysqld restart
mysql -u root -p

And we’re done.

Leave a Reply

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