Update MySQL root password

This function resets the root user's password on the local MySQL® server.

Important:

When you disable the MySQL/MariaDB role and remote MySQL is not already configured, the system disables this function.

SecurityBasicAuth
Request
query Parameters
password
required
string

The new MySQL root user's password.

Example: password=12345luggage
update_config
integer

Whether to update the configuration files.

  • 1 — Update.
  • 0 — Do not update.

Note:

This value is always enabled when localhost is the active profile, and must be specified explicitly when a remote profile is active.

Warning:

This parameter updates the /root/.my.cnf file with the new password, which could cause problems with the MySQL configuration on the server. If you are unsure, do not specify this parameter.

  • If you set this parameter to 0 when localhost is the active profile, it will stop communication with the remote MySQL server until you update the profile's password.
  • If you set this parameter to 1 when a remote host is the active profile, it will stop communication with the remote MySQL server until you update the profile's password.
Enum: 0 1
Example: update_config=1
Responses
200

HTTP Request was successful.

Response Schema: application/json
object
object
get/set_local_mysql_root_password
Request samples
whmapi1 --output=jsonpretty \
  set_local_mysql_root_password \
  password='12345luggage'
Response samples
application/json
{
  • "data": {
    • "configs_updated": 1,
    • "password_reset": 1,
    • "profile_updated": 1
    },
  • "metadata": {
    • "command": "set_local_mysql_root_password",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}