Exporting a database creates a backup file containing all the data and structure of your MySQL database. This is essential for backups, migrations, and setting up development environments. This guide covers exporting via phpMyAdmin in cPanel.
Exporting a Database via phpMyAdmin (Quick Method)
- Log in to your cPanel account.
- Scroll to the Databases section and click phpMyAdmin.
- In the left sidebar, expand the database list and click on the database you want to export.
- Click the Export tab at the top of the page.
- Select Quick - display only the minimal options.
- Under Format, select SQL.
- Click Go.
- Your browser will download the database backup as a
.sqlfile.
Exporting a Database (Custom Method)
The custom method gives you more control over the export:
- Click the Export tab.
- Select Custom - display all possible options.
- Under Tables, select which tables to export (or leave all selected).
- Under Output:
- Save output to a file: Downloads the export as a file.
- Compression: Choose
zippedorgzippedto compress the backup file.
- Under Format-specific options:
- Add DROP TABLE: Adds a command to drop existing tables before recreating them (recommended for restores).
- Click Go to download the export.
Exporting a Single Table
- In phpMyAdmin, click on the database in the left sidebar.
- Click on the specific table you want to export.
- Click the Export tab.
- Follow the same steps as above.
Alternative: Using the cPanel Backup Tool
- In cPanel, go to Files → Backup.
- Scroll to Download a MySQL Database Backup.
- Click the name of the database you want to download.
- A
.sql.gzfile will be downloaded to your computer.
This is the quickest way to create a backup, though it offers fewer options than phpMyAdmin.
Important Notes
- Store your backup files in a safe location (external drive, cloud storage) separate from your hosting account.
- Exported SQL files contain your database prefix (e.g.,
username_dbname). When importing on another server, you may need to adjust the prefix. - Regular backups are essential. Consider scheduling automatic backups via cPanel cron jobs.
- The export file size depends on the amount of data in your database. Large databases may take longer to export.
Troubleshooting
Export download fails or times out:
- The database may be too large for a browser download. Try the cPanel Backup tool instead.
- For very large databases, contact your hosting provider or use SSH to export.
Exported file is empty or very small:
- Verify that the database contains data by browsing the tables in phpMyAdmin.
- Ensure you selected all tables before exporting.
"Access denied" when trying to export:
- Ensure the database user has sufficient privileges. Check in MySQL Databases → Add User to Database.