Create a randomly named MySQL username/database set.
This function creates a randomly named MySQL® database and user. This allows a 3rdparty tool to create its own DB without needing any knowledge of cPanel internals such as quotas or other limits. These will simply be passed back as an error.
Important:
When you disable the MySQL/MariaDB role and remote MySQL is not already configured, the system disables this function.
Request
- Base URLhttps://cpanel-server.tld:2083/execute
- AuthHTTP basic
Query parameters
An optional string to prepend to the randomly generated database name. This is in addition to the cPanel user which will appear prior to this. The prefix should be 6 characters or less and be only alphanumeric characters. WARNING: longer prexies lead to less entropy in the random username. Keep it short if you can!
Response
HTTP Request was successful.
Example response
{
"apiversion": 3,
"func": "setup_db_and_user",
"module": "Mysql",
"result": {
"data": {
"database": "cpuser_wp_gwl7vpix28owo855yjomc7rsghkbjv0d0kf45kcvzip9tyxw9kdd",
"database_user": "cpuser_wp_dji1jdt7nhjiwjcjju45",
"database_user_password": ";1t/U:wnFkCRL9q68]/+<TX=.C#7]n",
"hostname": "localhost",
"port": "3306"
},
"status": 1
}
}Changes
No recorded changes to this operation across all 5 revisions of this API.