Reset/Change the MySQL Root Password on a cPanel Server (Linux)

On a Linux server or VPS with cPanel/WHM, there are two ways to reset the root password for MySQL. One method uses the WHM admin web panel, while the other uses the command line (shell).

Reset the MySQL root password in WHM

On servers with cPanel/WHM, it is recommended to change the MySQL root password via WHM. Follow the instructions below to change the MySQL root password in WHM:

1. Log in to the WHM admin interface at: (Using your server’s hostname or IP address.)

Screen Shot 2015-12-16 at 10.15.54 PM

2. Look in SQL Services > MySQL Root Password.

Screen Shot 2015-12-16 at 10.15.25 PM

3. Choose a secure password and commit the change. That’s all you need to do!

Screen Shot 2015-12-16 at 10.16.19 PM

Reset the MySQL root password via SSH

To change or reset your server’s MySQL root password via SSH command line, follow the steps below:

1. Connect to your server via SSH as the root user.

2. Stop the mysqld service by running the command:

/etc/init.d/mysql stop

3. Run the following commands as shown:

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


This entry was posted in cPanel/WHM, Guides & How To's, Linux VPS, Tech Support and tagged , , , , . Bookmark the permalink. Trackbacks are closed, but you can post a comment.

Questions? We're here to help.