# 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.

Endpoint: GET /Mysql/setup_db_and_user
Version: 11.136.0.19
Security: BasicAuth

## Query parameters:

  - `prefix` (string)
    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!
    Example: "wp"

## Response 200 fields (application/json):

  - `apiversion` (integer)
    The version of the API.
    Example: 3

  - `func` (string)
    The name of the method called.
    Example: "setup_db_and_user"

  - `module` (string)
    The name of the module called.
    Example: "Mysql"

  - `result` (object)

  - `result.data` (object)

  - `result.data.database` (any)
    The randomized name of the database created. This is normally prefixed with the account username and can also be prefixed with application prefix.

  - `result.data.database_user` (any)
    The randomized username assigned to the database. This is normally prefixed with the account username and can also be prefixed with application prefix.

  - `result.data.database_user_password` (string)
    A randomly generated password intended to be maximally randomized.
    Example: ";1t/U:wnFkCRL9q68]/+<TX=.C#7]n"

  - `result.data.hostname` (any)
    The hostname to connect to from within the server to connect to the MySQL server

  - `result.data.port` (string)
    The port to connect to from within the server to connect to the MySQL server
    Example: 3306

  - `result.errors` (array,null)
    List of errors if the API failed.

  - `result.messages` (array,null)
    List of messages generated by the API.

  - `result.metadata` (object)

  - `result.status` (integer)
    * 1 - Success
* 0 - Failed: Check the errors field for more details.
    Enum: 0, 1

  - `result.warnings` (array,null)
    List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API.


