---
title: "How to create a MySQL database in cPanel"
description: "How to create a database, user and permissions with the cPanel wizard, where to find the connection details for WordPress and Laravel, and how to use phpMyAdmin to import and export."
url: "https://redhosting.com.br/en/base-de-conhecimento/como-criar-um-banco-de-dados-mysql-no-cpanel"
type: "article"
language: "en"
category: "cPanel"
published: "2026-09-02"
translations:
  pt-BR: "https://redhosting.com.br/base-de-conhecimento/como-criar-um-banco-de-dados-mysql-no-cpanel.md"
  en: "https://redhosting.com.br/en/base-de-conhecimento/como-criar-um-banco-de-dados-mysql-no-cpanel.md"
  es: "https://redhosting.com.br/es/base-de-conhecimento/como-criar-um-banco-de-dados-mysql-no-cpanel.md"
  de: "https://redhosting.com.br/de/base-de-conhecimento/como-criar-um-banco-de-dados-mysql-no-cpanel.md"
---

# How to create a MySQL database in cPanel

How to create a database, user and permissions with the cPanel wizard, where to find the connection details for WordPress and Laravel, and how to use phpMyAdmin to import and export.

- RedHosting knowledge base guide — category: cPanel
- HTML page: https://redhosting.com.br/en/base-de-conhecimento/como-criar-um-banco-de-dados-mysql-no-cpanel
- Published on: 2026-09-02 · Language: en

Every site that stores information — WordPress, a store, a PHP system — needs a database. In cPanel, creating one takes less than a minute with the wizard, which sets up the database, user and permissions in a single sequence.

## 1. Creating it with the wizard

- Log in to cPanel and, under **Databases**, click **MySQL Database Wizard**.
- **Step 1** — give the database a name, for example `wordpress`. Click **Next Step**.
- **Step 2** — create the user and password. Use the **Generate** button and copy the password before continuing. Click **Create User**.
- **Step 3** — check **ALL PRIVILEGES** and click **Next Step**.

  ⚠️**Watch the prefix**: cPanel adds your account name in front. If the account is `mystore` and you typed `wordpress`, the database is called `mystore_wordpress` — and that full name is what goes in the configuration. The same applies to the user.

## 2. The connection details

Four pieces of information, always the same:

- **Server**: `localhost`
- **Database name**: the full name, with the prefix
- **Username**: the full name, with the prefix
- **Password**: the one you generated

The server is `localhost` because the site and the database run on the same machine. It's only different if you connect from outside — and then you need to allow your IP under **Databases** → **Remote MySQL**.

### In WordPress

The installer asks for exactly these four fields. If you're editing `wp-config.php` by hand:

```
define('DB_NAME', 'mystore_wordpress');
define('DB_USER', 'mystore_wpuser');
define('DB_PASSWORD', 'your-password-here');
define('DB_HOST', 'localhost');
```

### In Laravel

In the `.env` file:

```
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=mystore_app
DB_USERNAME=mystore_appuser
DB_PASSWORD=your-password-here
```

## 3. Using phpMyAdmin

phpMyAdmin is the interface for viewing and editing the database's contents. It's under **Databases** → **phpMyAdmin** and opens already signed in.

### Importing an existing database

When migrating a site from another host:

- Select the target database in the list on the left.
- Click the **Import** tab.
- Choose the `.sql` file and click **Go**.

If the file is too big for the upload limit, compress it as `.zip` or `.gz` — phpMyAdmin accepts both and the compressed file usually fits. Beyond that, support will import it for you.

### Exporting a copy

- Select the database and click **Export**.
- Leave the method on **Quick** and the format on **SQL**.
- Click **Go**. The file downloads to your computer.

Do this before any big update to the site. It's the copy you control — the hosting also keeps a daily automatic backup, but yours is in your hands whenever you need it.

## 4. When the connection fails

### "Error establishing a database connection"

In order of frequency: the database or user name is missing the account prefix; the password has an extra space at the end; or the user wasn't linked to the database. You can check the link under **MySQL Databases**, in the **Current Users** section — the user must be listed under the database.

### "Access denied for user"

Wrong username or password, or the user exists but has no privileges on that database. Under **MySQL Databases** → **Add User To Database**, redo the link checking **ALL PRIVILEGES**.

### I forgot the database password

It can't be recovered, only changed: under **MySQL Databases**, in the user list, click **Change Password**. Remember to update the new password in `wp-config.php` or `.env`, or the site will stop working.

## 5. How many databases your plan allows

1 on Bronze, 5 on Silver (Prata), 10 on Gold (Ouro) and unlimited on Business. Each site installation usually uses one.

## Need help?

Open a ticket at [financeiro.redhosting.com.br](https://financeiro.redhosting.com.br) or contact support on WhatsApp at **+55 11 98833-3902**.

## Frequently asked questions

**Which database server should I enter in the configuration?**

`localhost`, because the site and the database run on the same machine. It's only different if you connect from outside, and then you need to allow your IP under Databases → Remote MySQL.

**Why does my database name have a prefix?**

cPanel adds your account name in front of what you typed. The full name, with the prefix, is what goes in the site's configuration — for both the database and the user.

**I get "Error establishing a database connection". What is it?**

In order of frequency: database or user name without the account prefix, an extra space at the end of the password, or the user not linked to the database. Check the link under MySQL Databases, in the Current Users section.

**How do I import a database from another host?**

Through phpMyAdmin: select the target database, Import tab, choose the .sql file and click Go. If the file is too big, compress it as .zip or .gz.

**I forgot the database password. Can I recover it?**

No, only change it: under MySQL Databases, in the user list, click Change Password. Remember to update the new password in wp-config.php or .env, or the site will stop working.

## Navigation — cPanel (article 5 of 6)

- Previous article: [How to enable free SSL in cPanel](https://redhosting.com.br/en/base-de-conhecimento/como-ativar-o-ssl-gratuito-no-cpanel.md) — https://redhosting.com.br/en/base-de-conhecimento/como-ativar-o-ssl-gratuito-no-cpanel
- Next article: [How to create an email account in cPanel and set it up on your phone](https://redhosting.com.br/en/base-de-conhecimento/como-criar-um-email-no-cpanel-e-configurar-no-celular.md) — https://redhosting.com.br/en/base-de-conhecimento/como-criar-um-email-no-cpanel-e-configurar-no-celular
- Back to the knowledge base: https://redhosting.com.br/en/base-de-conhecimento

---

Need help with these steps? RedHosting's 24/7 support: suporte@redhosting.com.br · WhatsApp +55 11 98833-3902 · https://redhosting.com.br/discord

More guides: https://redhosting.com.br/en/base-de-conhecimento.md
