cPanel & WHM Version 108 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

I need to change root password without restarting MySQL Server

Shyamasundar Bhat shared this idea 16 months ago
Needs Review

We wanted to randomly change MySQL passwords on our cPanel servers, however, we noticed that, MySQL was being restarted after root password is reset using whmapi1 call. Here is commands run and output:

[root@sql-ser:/root]$ whmapi1 set_local_mysql_root_password password="some-password"
configs_updated: 1
password_reset: 1
profile_updated: 1
command: set_local_mysql_root_password
reason: OK
result: 1
version: 1
[root@sql-ser:/root]$ cat /root/.my.cnf
[root@sql-ser:/root]$ mysqladmin version | grep Uptime
Uptime: 32 sec
I would like to be able to update mysql root user passwords via whmapi1 set_local_mysql_root_password periodically WITHOUT RESTARTING MYSQL SERVER. 

Note: All MySQL servers are localhost and not remote (at least if you can do this).

Replies (1)


Hey there! The API call assumes the existing root password is not known, and follows the steps outlined here:

Per the MySQL documentation, you can use a standard ALTER USER statement to update the password, even for root, without it initiating a restart.

I still think this is a valid request, so I'll see if the API call can have a flag added to avoid the restart. Thanks!

Leave a Comment
Attach a file