Update MySQL username

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

Important:

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

SecurityBasicAuth
Request
query Parameters
newname
required
string

The database user's new name.

Warning:

If database prefix is enabled, this parameter must include the database prefix for the account.

Example: newname=username2
oldname
required
string

The database user's current name.

Example: oldname=username
cpuser
string <username>

The database user's owner.

Example: cpuser=example
Responses
200

HTTP Request was successful.

Response Schema: application/json
object
get/rename_mysql_user
Request samples
whmapi1 --output=jsonpretty \
  rename_mysql_user \
  oldname='username' \
  newname='username2'
Response samples
application/json
{
  • "metadata": {
    • "command": "rename_mysql_user",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}