---
title: "Create a randomly named MySQL username/database set."
method: GET
path: "/Mysql/setup_db_and_user"
tags: ["Mysql", "Database Management"]
---

# Create a randomly named MySQL username/database set.

`GET /Mysql/setup_db_and_user`

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](https://go.cpanel.net/howtouseserverprofiles#roles) **and** remote MySQL is **not** already configured, the system **disables** this function.

## Query parameters

- `prefix` string

## Response `200`

HTTP Request was successful.

- object
  - `apiversion` integer — The version of the API.
  - `func` string — The name of the method called.
  - `module` string — The name of the module called.
  - `result` object
    - `data` object
      - `database` union — The randomized name of the database created. This is normally prefixed with the account username and can also be prefixed with application prefix.
        - string, database name
        - string, database name
      - `database_user` union — The randomized username assigned to the database. This is normally prefixed with the account username and can also be prefixed with application prefix.
        - string, database username
        - string, database username
      - `database_user_password` string, password — A randomly generated password intended to be maximally randomized.
      - `hostname` union — The hostname to connect to from within the server to connect to the MySQL server
        - string, hostname
        - string, hostname
      - `port` string, unix-port — The port to connect to from within the server to connect to the MySQL server
    - `errors` string[], nullable — List of errors if the API failed.
    - `messages` string[], nullable — List of messages generated by the API.
    - `metadata` object
    - `status` 0 | 1 — * `1` - Success * `0` - Failed: Check the `errors` field for more details.
    - `warnings` string[], nullable — List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API.

---

[API](https://skmtc.net/cpanel/apis/cpanel-uapi.md) · [All operations](https://skmtc.net/cpanel/apis/cpanel-uapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cpanel/cpanel-uapi/revisions/632e2f8e6d04/schema)
