Description

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

Examples 




https://hostname.example.com:2087/cpsess##########/json-api/rename_mysql_user?api.version=1&oldname=username&newname=username2&cpuser=example




https://hostname.example.com:2087/cpsess##########/xml-api/rename_mysql_user?api.version=1&oldname=username&newname=username2&cpuser=example




whmapi1 rename_mysql_user oldname=username newname=username2 cpuser=example



{
  "metadata": {
    "version": 1,
    "reason": "OK",
    "result": "1",
    "command": "rename_mysql_user"
  }
}




<result>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <result>1</result>
        <command>rename_mysql_user</command>
    </metadata>
</result>



Parameters

ParameterTypeDescriptionPossible valuesExample
oldnamestring

Required

The database user's current name.

A valid username.

 username

newname

string

Required

The database user's new name.

A valid username.

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


username2
cpuserstringThe database user's owner.A valid username.example

Returns

This function only returns metadata.

This function's metadata includes the payload_is_literal return. For more information, read our WHM API 1 - Return Data documentation.