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.
uapi --output=jsonpretty \ --user=username \ Mysql \ setup_db_and_user \ prefix='wp'
{- "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
}, - "errors": null,
- "messages": null,
- "metadata": { },
- "status": 1,
- "warnings": null
}
}