# Create and manage MySQL databases
Source: https://docs.webgee.com/en/databases/how-to-create-and-manage-mysql-databases-in-cpanel





Create a MySQL database and a user that can reach it. Applies to shared,
reseller and Premium hosting.

Most applications need three things: a database, a user, and that user granted
privileges on it. Creating the first two and forgetting the third is the usual
reason an install fails with a connection error.

<img alt="Manage My Databases, showing Create New Database and the repair tools" src="__img0" />

Database and user names are prefixed with your cPanel username — entering `shop`
creates `webgeedemo_shop`. Applications need the **full prefixed name**, and
using the unprefixed one is a common cause of connection failures.

## Create a database and user [#create-a-database-and-user]

The wizard does all three steps in order, which is why it is worth using:

1. In cPanel, open **MySQL Database Wizard** under **Databases**.
2. Enter a database name, then **Next Step**.
3. Enter a username and password — use **Password Generator** — then
   **Create User**.
4. Grant **All Privileges**, then **Next Step**.

Keep the database name, username and password. You need all three to connect.

<Callout type="info">
  cPanel prefixes both names with your cPanel username. A database you name
  `wordpress` becomes `cpaneluser_wordpress`, and that full name is what your
  application must use.
</Callout>

## Or do it manually [#or-do-it-manually]

Under **MySQL Databases** you can create each part separately, which is what you
want when adding a second user to an existing database:

* **Create New Database** — the database
* **Add New User** — the user
* **Add User To Database** — the grant, which is the step people miss

## Connection settings [#connection-settings]

| Setting  | Value               |
| -------- | ------------------- |
| Host     | `localhost`         |
| Database | `cpaneluser_dbname` |
| Username | `cpaneluser_dbuser` |
| Password | as set              |
| Port     | `3306`              |

`localhost` is correct because the database runs on the same server as your site.
Use it rather than your domain — it connects over a local socket, which is faster
and avoids the firewall entirely.

To connect from **outside** the server, see
[Allow remote MySQL connections](/en/databases/mysql-remote-connections).

## Change a password [#change-a-password]

Under **MySQL Databases → Current Users**, select **Change Password**.

Remember to update it in your application's configuration at the same time —
`wp-config.php` for WordPress. Changing it in cPanel alone takes the site down.

## Delete a database [#delete-a-database]

Deleting is immediate and permanent. Take a backup first — see
[Download a backup of your account](/en/backups/how-to-generate-download-a-website-backup).

## Check it worked [#check-it-worked]

```bash
mysql -u cpaneluser_dbuser -p cpaneluser_dbname -e "SELECT 1;"
```

A `1` back means the user, the password and the grant are all correct. `Access
denied` almost always means the grant is missing, not that the password is wrong.

## Related [#related]

* [Allow remote MySQL connections](/en/databases/mysql-remote-connections)
* [Import a large database](/en/databases/how-to-import-a-large-database-into-mysql)
