latestOpenAPI 3.0.2cPanel License2026-08-106251554.3 MB

3da41671c02c

Databases
Manage MySQL Server

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.

get/set_local_mysql_root_password

Query parameters

passwordstring required
Example:12345luggage

The new MySQL root user's password.

update_config0 | 1
Example:1

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.

Response

HTTP Request was successful.

Example response

{
  "data": {
    "configs_updated": 1,
    "password_reset": 1,
    "profile_updated": 1
  },
  "metadata": {
    "command": "set_local_mysql_root_password",
    "reason": "OK",
    "result": 1,
    "version": 1
  }
}