Most modern web applications — WordPress, Joomla, Drupal, Magento, custom apps — need a MySQL database. cPanel's database tools handle creation, user management, and access control without ever touching the command line. This article walks through the fundamentals and the gotchas.
Conceptual model: databases vs. users
A database is the container for tables and data. A user is a credential that can connect to one or more databases. Best practice: one database per application, one dedicated user per database, never share users across applications.
cPanel prefixes everything with your account name. If your cPanel username is acme, your databases will be named like acme_wordpress and your users like acme_wpuser. The prefix is automatic and required.
Create a database
- cPanel → MySQL Databases (under "Databases").
- Under Create New Database, enter the database name (just the part after the underscore prefix).
- Click Create Database.
Create a database user
- Same page, scroll down to MySQL Users.
- Enter username and password. Use the password generator — ~16 characters of mixed case, digits, and symbols.
- Click Create User.
Save the password before clicking elsewhere. cPanel doesn't let you retrieve it later; you can only reset it.
Grant the user access to the database
- Scroll to Add User To Database.
- Pick the user and database from the dropdowns.
- Click Add.
- On the privileges page, tick ALL PRIVILEGES (the only sensible default for an application database).
- Click Make Changes.
Now the user can connect to the database. The connection details for your application:
- Database host:
localhost - Database name:
cpanelusername_dbname(with the prefix) - Database user:
cpanelusername_username(with the prefix) - Database password: what you saved earlier
Alternative: Use phpMyAdmin instead
If you'd rather skip the cPanel UI and work directly with the database (importing a SQL file, editing a table, running queries), phpMyAdmin is the answer. cPanel includes it; click phpMyAdmin from the Databases section. We have a separate phpMyAdmin guide.
Connect from outside cPanel (remote MySQL)
By default, MySQL only accepts connections from localhost — your applications running on the same server. If you need to connect from your laptop, a CI/CD pipeline, or another server:
- cPanel → Remote MySQL.
- Enter the IP that needs access.
- Click Add Host.
You can also use a wildcard pattern like %.yourcompany.com, but be cautious — broadening access widens the attack surface. Use SSH tunneling instead when possible (connect via SSH, forward MySQL's port to your local machine).
Backup a database
Three options, in order of complexity:
Option A: cPanel's Backup tool
cPanel → Backup → under "Download a MySQL Database Backup", click the database name. Downloads a .sql.gz file. Detail in our backups article.
Option B: phpMyAdmin export
Open phpMyAdmin, select the database, click Export, accept defaults (Quick + SQL), click Export. Downloads a .sql file directly.
Option C: Command line (if you have SSH)
$ mysqldump -u username -p databasename > backup.sql.gz
Useful for cron-driven nightly database backups.
Restore a database
- If the database doesn't exist yet, create it via cPanel's MySQL Databases tool.
- Open phpMyAdmin and select the (empty) target database.
- Click Import → pick the
.sqlfile → click Go.
For files over 50 MB, phpMyAdmin times out. Either split the file (use a tool like BigDump) or restore via SSH:
$ mysql -u username -p databasename < backup.sql
Database limits
Your hosting plan limits how many databases you can have:
- IronHOST: 5 databases
- BronzeHOST: 25 databases
- CopperHOST and up: unlimited databases
If you need to consolidate, applications generally don't share databases well; better to upgrade the plan than try to cram multiple apps into one schema.
Common pitfalls
- "Access denied for user." The user wasn't added to the database, or the privileges were saved without ALL PRIVILEGES ticked. Re-check.
- "Connection refused." You're using
127.0.0.1in your config when cPanel expectslocalhost. Uselocalhost. - Forgot the password. cPanel can't recover it. Reset via Change Password next to the user, then update your application's config file.
- Using the cPanel master credentials. Your cPanel login cannot connect to MySQL directly — you have to create a separate MySQL user. This trips up everyone the first time.