Free managed migration on every cPanel 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
31 Oct 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 Database Wizard

    In cPanel, go to Databases → Database Wizard (called MySQL Database Wizard in cPanel 118 and earlier). 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 Next Step.

  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. Terminal needs shell access, which our cloud plans include.

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 Manage My Databases (MySQL Databases in cPanel 118 and earlier); 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 WordPress7 min

→Hosting for this

Plans that fit what you just read.

A GST invoice on every plan, and free SSL and free managed migration on the cPanel plans (shared, WordPress, cloud and reseller). On VPS and VDS, migration is free with managed support.

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 SSL and managed migration on cPanel plans, and engineers on WhatsApp chat, 24/7, with a first reply in under 2 minutes.

See pricing Talk to an engineer

First reply: under 2 min on WhatsApp