- Created by Documentation, last modified on Oct 05, 2018
disable_authentication_provider
disable_failing_authentication_providers
enable_authentication_provider
get_available_authentication_providers
get_provider_client_configurations
get_provider_configuration_fields
get_provider_display_configurations
get_users_authn_linked_accounts
set_provider_client_configurations
set_provider_display_configurations
twofactorauth_generate_tfa_config
twofactorauth_get_user_configs
cpgreylist_is_server_netblock_trusted
cpgreylist_list_entries_for_common_mail_provider
cpgreylist_load_common_mail_providers_config
cpgreylist_save_common_mail_providers_config
cpgreylist_trust_entries_for_common_mail_provider
cpgreylist_untrust_entries_for_common_mail_provider
create_cpgreylist_trusted_host
delete_cpgreylist_trusted_host
block_incoming_email_from_country
block_incoming_email_from_domain
expunge_messages_for_mailbox_guid
get_unique_recipient_count_per_sender_for_user
get_unique_sender_recipient_count_per_user
get_user_email_forward_destination
list_blocked_incoming_email_countries
list_blocked_incoming_email_domains
set_user_email_forward_destination
unblock_incoming_email_from_country
unblock_incoming_email_from_domain
Description
This function changes a MySQL® database user's name.
Important:
MySQL
role, the system disables this function. For more information, read our How to Use Server Profiles documentation.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
Notes:
- Unless otherwise noted, you must URI-encode values.
- For more information and additional output options, read our Guide to WHM API 1 documentation or run the
whmapi1 --help
command. If you run CloudLinux™, you must use the full path of the
whmapi1
command:/usr/local/cpanel/bin/whmapi1
{ "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>
Note:
Parameters
Parameter | Type | Description | Possible values | Example |
---|---|---|---|---|
oldname | string | Required The database user's current name. | A valid username. Important: To learn more about database username limits, click your database type: MySQL 5.6 MySQL version 5.6 limits the database username to 16 characters. The server uses the first nine characters of this limit for the database prefix. The database prefix uses the cPanel account's username and an underscore ( For example:
MySQL 5.7+ MySQL versions 5.7 and later limit the database username to 32 characters. The server uses the first nine characters of this limit for the database prefix. The database prefix uses the cPanel account's username and an underscore ( For example:
MariaDB MariaDB limits the database username to 47 characters. The server uses the first nine characters of this limit for the database prefix. The database prefix uses the cPanel account's username and an underscore ( For example:
| username |
| string | Required The database user's new name. | A valid username. Warning If database prefix is enabled, this parameter must include the database prefix for the account. | username2 |
cpuser | string | The database user's owner. | A valid username. | example |
Returns
This function only returns metadata.
Note:
This function's metadata includes the payload_is_literal
return. For more information, read our WHM API 1 - Return Data documentation.
Function information
API Version:
Available in:
WHM 11.44+
Methods:
GET, POST
Required Parameters:
oldname
, newname
Return Formats:
About WHM API 1
WHM API 1 performs functions and accesses data in WHM.
Notes:
- Some functions and parameters may require that you authenticate as the
root
user. - You must use the appropriate WHM ports (
2086
or2087
) to call WHM API functions.
Find a function
Related functions
-
Page:WHM API 1 Sections - Databases — Database functions allow you to manage your MySQL® and PostgreSQL® database settings.
-
Page:WHM API 1 Functions - rename_mysql_database — This function changes a MySQL® database's name.
-
Page:WHM API 1 Functions - rename_mysql_user — This function changes a MySQL® database user's name.
-
Page:WHM API 1 Functions - set_mysql_password — This function changes a MySQL® database user's password.
-
Page:WHM API 1 Functions - installable_mysql_versions — This function lists all available versions of MySQL® and MariaDB.