This article will walk you through manually resetting the MySQL root password in the event that the password in '/root/.my.cnf' becomes desynced.
Please note that these steps are best performed by a qualified system administrator and cPanel support staff will not be able to perform these steps for you.
Log into WHM, click on Service Manager under the 'Service Configuration' section and disable monitoring for the MySQL service.
Connect to the server via SSH as the root user
Stop the MySQL service:
Create a text file in - /var/lib/mysql - called 'mysql-init':
Add the following text to that file where 'MyNewPass' represents the password you would like to use:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
Update the password in - /root/.my.cnf - to the password used in this statement:
grep -i pass /root/.my.cnf
Change the ownership of the file to ensure there are no issues reading the file:
chown -v mysql. /var/lib/mysql/mysql-init
Start MySQL manually using the following:
mysqld -u mysql --init-file=/var/lib/mysql/mysql-init &
Now that the password has been updated, shutdown MySQL safely using the following:
Remove the init file:
/bin/rm -vi /var/lib/mysql/mysql-init
Restart MySQL normally:
In the WHM interface, re-enable MySQL service monitoring in Service Manager --> Service Configuration
*Note when using MySQL 5.7*
It may be necessary to use the following statement in place of the 'alter' statement shown above:
SET authentication_string = PASSWORD('MyNewPass'), password_expired = 'N'
WHERE User = 'root' AND Host = 'localhost';
More information on these steps can be found in the official MySQL documentation here: