Accidentallly change cpanel server mysql password

The actual fix:

Long story short, I set a new password by hand. If you have this problem perform the steps below through command-line. Please note this was done on CentOS 7 and the steps may differ per installation (do these steps quickly as it reduces your security until you finally start mysqld again):

1) systemctl stop mysqld
2) systemctl set-environment MYSQLD_OPTS=”–skip-grant-tables”
3) systemctl start mysqld
4) mysql -u root
5) UPDATE mysql.user SET authentication_string = PASSWORD(‘yournewpass’) WHERE User = ‘root’ AND Host = ‘localhost’;
7) quit
8) systemctl stop mysqld
9) systemctl unset-environment MYSQLD_OPTS
10) vi or nano /root/.my.cnf and adjust the passwords to your new pass
11) systemctl start mysqld
12) test your pass: mysql -u root -p



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.