Update MySQL user password

This function changes a MySQL® database user's password.

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 database user's new password.

Example: password=123456luggage
user
required
string <username>

The database username. For information about database username restrictions, read the MySQL and MariaDB documentation.

Example: user=username
cpuser
string <username>

The cPanel user that controls the database user.

Example: cpuser=example
Responses
200

HTTP Request was successful.

Response Schema: application/json
object
get/set_mysql_password
Request samples
whmapi1 --output=jsonpretty \
  set_mysql_password \
  user='username' \
  password='123456luggage'
Response samples
application/json
{
  • "metadata": {
    • "command": "set_mysql_password",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}