Knowledge Base
How to Create a MySQL Database and Import SQL in cPanel
TL;DR
Key Takeaways
- Create MySQL databases in cPanel using Database Wizard or Manage My Databases, not inside phpMyAdmin.
- Add a database user, assign privileges, then import SQL via phpMyAdmin.
- Update application config files like wp-config.php with the prefixed database name and user.
Summarized by Pakish Group (Pakish.NET) for AI and search citation.
Create MySQL databases in cPanel through Database Wizard or Manage My Databases — never create cPanel-managed databases directly inside phpMyAdmin. Add a database user, assign ALL PRIVILEGES on that database only, then open phpMyAdmin to import your .sql file. Use the full prefixed database name and username in wp-config.php or your application settings.
See the (/blog/cpanel-wordpress-webmail-beginners-guide). WordPress troubleshooting: (/blog/known-wordpress-bugs-how-to-fix).
Key Takeaways
- Use Database Wizard or Manage My Databases to create DB + user
- Database names are prefixed with your cPanel username
- phpMyAdmin is for import/export and queries — not account creation
- Export a backup before importing or altering tables
- Update
wp-config.phpwith full prefixed credentials - Never grant unnecessary global database privileges
Before You Start
| Item | Details |
|---|---|
| Backup | Export existing database if replacing data |
| SQL file | .sql dump from source site |
| Credentials | Note database name, user, password |
Create or confirm a usable backup first. Availability and limits may vary by hosting plan or server configuration.
Database Wizard vs Manage My Databases
| Tool | Best for | |---|---| | Database Wizard | Step-by-step first database + user setup | | Manage My Databases | Creating additional databases, users, and privilege edits |
Both create properly prefixed cPanel-managed databases.
Create a Database and User (Wizard)
- cPanel → Databases → Database Wizard
- Step 1: Enter database name (e.g.
wpdb) → Next Step - cPanel shows full name:
username_wpdb - Step 2: Create user — enter username and strong password → Create User
- Step 3: Grant ALL PRIVILEGES → Next Step → Complete
Create Manually via Manage My Databases
- Create New Database → enter name → Create Database
- MySQL Users → Add New User → username + password → Create User
- Add User To Database → select user and database → Add
- Check ALL PRIVILEGES → Make Changes
Understanding Database Prefixes
On shared hosting, cPanel prefixes names:
- Database:
cpuser_mydb - User:
cpuser_mydbuser
Always use the full prefixed values in application configuration.
Open phpMyAdmin
- cPanel → Databases → phpMyAdmin
- Select your database in the left sidebar
- Browse tables or run SQL queries
Import an SQL File
- Select the target database
- Click Import tab
- Choose File → select
.sqldump - Format: SQL
- Click Go
- Wait for success message — large files may take minutes
If import fails due to size limits, split the file or contact support about limits.
Export a Database Backup
- Select database in phpMyAdmin
- Export → Quick → format SQL
- Go → save file off-site
Also consider (/blog/restore-backups-jetbackup-5-cpanel) for server-side snapshots.
Check and Repair a Database
- phpMyAdmin → select database
- Check All tables → Check Table
- If errors: select affected tables → Repair Table
For WordPress, also try plugins like WP-DBManager or hosting tools before manual repair.
Update Application Configuration
WordPress wp-config.php:
define('DB_NAME', 'username_database_name');
define('DB_USER', 'username_database_user');
define('DB_PASSWORD', 'your_password');
define('DB_HOST', 'localhost');
Back up wp-config.php via (/blog/how-to-use-cpanel-file-manager) before editing.
Common Authentication and Import Errors
| Error | Fix | |---|---| | Access denied for user | Wrong password or user not added to database | | Unknown database | Typo in prefixed database name | | #1044 — cannot create database | Create DB in cPanel, not phpMyAdmin | | Import too large | Split SQL; check upload limits | | #1273 — unknown collation | Export from compatible MySQL version |
Rollback Precautions
- Keep pre-import SQL export
- Restore via phpMyAdmin Import or (/blog/restore-backups-jetbackup-5-cpanel)
- Revert
wp-config.phpif credentials changed incorrectly
How to Verify It Worked
- phpMyAdmin shows expected tables and row counts
- Application connects without database errors
- WordPress admin loads; posts and pages display
- No new errors in cPanel error log
When to Contact Pakish Support
Contact support for remote database hosts, import size limits, corrupted tables that will not repair, or migration assistance. See (/blog/a-step-by-step-guide-to-moving-your-pakistani-business-to-managed-wordpress) or (/support).
Frequently Asked Questions
Should I create databases inside phpMyAdmin?
No. Create databases and users through cPanel Database Wizard or Manage My Databases. phpMyAdmin is for managing data inside databases that cPanel already created.
Why does my database name have a prefix?
cPanel adds your account username as a prefix to database and user names for isolation on shared servers. Use the full prefixed name in wp-config.php and application settings.
What privileges should I assign to a WordPress database user?
Assign ALL PRIVILEGES for a dedicated WordPress database user on that database only. Never grant global privileges beyond what the application needs.
My SQL import fails with a max upload size error — what do I do?
Split large SQL files, use command-line import via SSH if available, or compress the SQL file. Upload limits may vary by hosting plan or server configuration.
How do I export a database backup before making changes?
Open phpMyAdmin, select the database, click Export, choose Quick method and SQL format, then download the file. Store it off-site before imports or schema changes.
Related Guides
- (/blog/cpanel-wordpress-webmail-beginners-guide)
- (/blog/how-to-use-cpanel-file-manager)
- (/blog/known-wordpress-bugs-how-to-fix)
- (/blog/restore-backups-jetbackup-5-cpanel)
- (/blog/a-step-by-step-guide-to-moving-your-pakistani-business-to-managed-wordpress)
Migrate with confidence on (/managed-wordpress-hosting) — staging, backups, and database support included.
Sources
- (https://docs.cpanel.net/cpanel/databases/mysql-database-wizard/)
- (https://docs.cpanel.net/cpanel/databases/phpmyadmin/)
About the Author
Pakish Support Team
The Pakish Support Team provides 24/7 technical assistance, hosting tutorials, and knowledge base articles to help Pakistani businesses manage their web presence with confidence.