Paper Lantern for cPanel accounts is being retired this year. Find out more »
cPanel & WHM Version 102 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 4 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"
---
data:
configs_updated: 1
password_reset: 1
profile_updated: 1
metadata:
command: set_local_mysql_root_password
reason: OK
result: 1
version: 1
[root@sql-ser:/root]$
[root@sql-ser:/root]$ cat /root/.my.cnf
[client]
password="some-password"
user=root
[root@sql-ser:/root]$ 
[root@sql-ser:/root]$ mysqladmin version | grep Uptime
Uptime: 32 sec
[root@sql-ser:/root]$ 
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).

Leave a Comment
 
Attach a file