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.
-
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.
-
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 likecpuser_shop. Write down the full name; your application needs it exactly. -
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.
-
04
Grant privileges
For a normal application, tick ALL PRIVILEGES. For a reporting or read-only user, tick only SELECT. Click Make Changes.
-
05
Connect your application
Use
localhostas the database host, with the full prefixed database name, username and password. In WordPress these go inwp-config.phpasDB_NAME,DB_USER,DB_PASSWORDandDB_HOST.To load existing data, open phpMyAdmin, select the database and use Import with your
.sqlor.sql.gzfile. 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
→Read next
→Hosting for this
Plans that fit what you just read.
Every plan includes free SSL, free managed migration and a GST invoice.
→Get started
Hosting that does this for you.
Free managed migration, free SSL, and engineers who answer in under two minutes.