Free managed migration on every plan — we move your sites the same day. All systems operational +91 74091 34231

How-tocPanel

How to create a MySQL database in cPanel

Reading time
4 min
Last updated
24 Sep 2026

Most PHP applications, including WordPress, Laravel and Magento, keep their data in MySQL. In cPanel a working database needs three things: the database, a user, and permission linking the two. The wizard creates all three in one pass.

  1. 01

    Open the MySQL Database Wizard

    In cPanel, go to Databases → MySQL Database Wizard. Servers running MariaDB show the same screens under the same name.

  2. 02

    Name the database

    Type a short name such as shop. cPanel adds your account username as a prefix, so the real name becomes something like cpuser_shop. Write down the full name; your application needs it exactly.

  3. 03

    Create the database user

    Choose a username (it gets the same prefix) and use the Password Generator for a long random password. Save both. Give each application its own user, so one compromised app cannot read another's data.

  4. 04

    Grant privileges

    For a normal application, tick ALL PRIVILEGES. For a reporting or read-only user, tick only SELECT. Click Make Changes.

  5. 05

    Connect your application

    Use localhost as the database host, with the full prefixed database name, username and password. In WordPress these go in wp-config.php as DB_NAME, DB_USER, DB_PASSWORD and DB_HOST.

    To load existing data, open phpMyAdmin, select the database and use Import with your .sql or .sql.gz file. For a file larger than the upload limit, use the cPanel Terminal: mysql -u cpuser_shopuser -p cpuser_shop < dump.sql.

Connecting from outside the server

By default a database only accepts connections from the server itself. To connect a desktop client or a reporting tool, add your IP address in Databases → Remote Database Access and use the server hostname instead of localhost. Allow single IP addresses rather than ranges, and remove them when you are done.

"Error establishing a database connection"

  • The prefix is missing. The database and user names include the cpuser_ prefix.
  • The user was never added to the database. Check Current Databases in MySQL Databases; the user should be listed under Privileged Users.
  • The password is wrong. Reset it under Current Users and update the app's config.
  • The host is not localhost. Applications on the same account connect to localhost.

Common questions

It depends on the plan. Each plan lists its limits on the pricing page.
localhost, for any application running in the same hosting account.
Our servers run MySQL or MariaDB. MariaDB is a drop-in replacement for MySQL, so applications written for MySQL work unchanged.
Export it from phpMyAdmin, or restore any earlier copy from the database backups in JetBackup.

→Read next

How to install WordPress WordPress6 min

→Hosting for this

Plans that fit what you just read.

Every plan includes free SSL, free managed migration and a GST invoice.

cPanel Hosting cPanel on LiteSpeed and NVMe, served from Indiafrom ₹49/mo
Shared Hosting Fast, affordable hosting for your first sitefrom ₹49/mo

→Get started

Hosting that does this for you.

Free managed migration, free SSL, and engineers who answer in under two minutes.

See pricing Talk to an engineer

Median support reply: 1m 48s