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.

Authorizations:
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.

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

Response Schema: application/json
object
object

Request samples

whmapi1 --output=jsonpretty \
  set_local_mysql_root_password \
  password='12345luggage'

Response samples

Content type
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
    }
}