UAPI accesses the cPanel interface's features. Use this API to access and modify cPanel account data and settings.
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/
https://{host}:{port}/execute/
Request
This function creates a MySQL® database user.
Important:
When you disable the MySQL role and remote MySQL is not already configured, the system disables this function.
A valid database username.
Important: ====
To learn more about database username limits, check 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 (_). The server only applies the first eight characters of the cPanel account's username.
For example:
- A
db_database prefix allows MySQL usernames of up to 13 characters. - An
example_database prefix allows MySQL usernames of up to eight characters.
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 (_). The server only applies the first eight characters of the cPanel account's username.
For example:
- A
db_database prefix allows MySQL usernames of up to 29 characters. - An
example_database prefix allows MySQL usernames of up to 24 characters.
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 (_). The server only applies the first eight characters of the cPanel account's username.
For example:
- A
db_database prefix allows MariaDB usernames of up to 44 characters. - An
example_database prefix allows MariaDB usernames of up to 39 characters.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Mysql/create_user
- A server running cPanel.
https://cpanel-server.tld:2083/execute/Mysql/create_user
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Mysql/create_user?name=dbuser&password=12345luggage&prefix-size=16'{ "apiversion": 3, "func": "create_user", "module": "Mysql", "result": { "data": null, "errors": null, "messages": null, "metadata": {}, "status": 1, "warnings": null } }
Request
This function deletes a MySQL® user.
Important:
When you disable the MySQL role and remote MySQL is not already configured, the system disables this function.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Mysql/delete_user
- A server running cPanel.
https://cpanel-server.tld:2083/execute/Mysql/delete_user
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Mysql/delete_user?name=example'{ "apiversion": 3, "func": "delete_user", "module": "Mysql", "result": { "data": null, "errors": null, "messages": null, "metadata": {}, "status": 1, "warnings": null } }
Request
This function lists a MySQL® database user's privileges.
Important:
When you disable the MySQL role and remote MySQL is not already configured, the system disables this function.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Mysql/get_privileges_on_database
- A server running cPanel.
https://cpanel-server.tld:2083/execute/Mysql/get_privileges_on_database
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/cpanel.openapi/Mysql/get_privileges_on_database?database=mydb&user=dbuser'{ "apiversion": 3, "func": "get_privileges_on_database", "module": "Mysql", "result": { "data": [ … ], "errors": null, "messages": null, "metadata": { … }, "status": 1, "warnings": null } }