Back to articles

How to create a MySQL database in cPanel

September 2, 2026
cPanel

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