How to Backup and Restore MySQL Databases
Regular database backups are essential to protect your website data. This guide explains how to create backups and restore them when needed using cPanel's tools.
Why Backup Your Database?
Database backups protect you from:
- Accidental deletion - Recovering data you accidentally removed
- Hacking attempts - Restoring clean data after a security breach
- Failed updates - Rolling back after a problematic plugin or theme update
- Server issues - Recovering from hardware failures or data corruption
- Migration - Moving your site to a new server or hosting provider
Method 1: Backup Using phpMyAdmin
phpMyAdmin provides the most control over your database exports:
- Log into cPanel and click phpMyAdmin under Databases
- Select your database from the left sidebar
- Click the Export tab at the top
- Choose export method:
- Quick - Uses default settings (recommended for most users)
- Custom - Allows you to customize export options
- Ensure format is set to SQL
- Click Go to download the backup file
Tip: For large databases, use Custom export and enable compression (gzip or zip) to reduce file size.
Method 2: Backup Using cPanel Backup Wizard
The Backup Wizard provides a simpler interface:
- In cPanel, go to Files → Backup Wizard
- Click Backup
- Select Partial Backup
- Click the database you want to backup under MySQL Databases
- The backup file will download automatically
Method 3: Command Line Backup (SSH)
For advanced users with SSH access:
mysqldump -u username -p database_name > backup_file.sql
To compress the backup:
mysqldump -u username -p database_name | gzip > backup_file.sql.gz
Restoring a Database Backup
Restore Using phpMyAdmin
- Open phpMyAdmin in cPanel
- Select your database from the left sidebar
- Click the Import tab
- Click Choose File and select your backup .sql file
- Leave default settings (Format: SQL)
- Click Go to import
Important: If restoring to an existing database with data, you may want to drop existing tables first to avoid conflicts.
Restore Using cPanel Backup Wizard
- Go to Files → Backup Wizard
- Click Restore
- Select MySQL Databases
- Click Choose File and select your backup
- Click Upload
Backup Best Practices
- Schedule regular backups - Daily for active sites, weekly for static sites
- Store backups off-server - Download backups to your computer or cloud storage
- Test your backups - Periodically restore to a test environment to verify they work
- Keep multiple versions - Maintain several recent backups in case you need to go back further
- Backup before changes - Always backup before updates, migrations, or major changes
- Name files clearly - Include database name and date (e.g.,
mysite_db_2026-02-05.sql)
Automated Backups with Softaculous
If you installed WordPress or another application via Softaculous, you can set up automatic backups:
- Go to Softaculous Apps Installer in cPanel
- Click All Installations
- Click the pencil (edit) icon next to your installation
- Scroll to Backup Settings
- Enable Automated Backups and set frequency
- Choose backup rotation (how many backups to keep)
- Click Save Installation Details
Troubleshooting Import Issues
If your import fails, try these solutions:
- File too large - Split the SQL file or use command line import via SSH
- Timeout errors - Import in smaller chunks or increase PHP timeout
- Character encoding issues - Ensure backup and import use the same encoding (UTF-8 recommended)
- Duplicate key errors - Drop existing tables before importing or use "Add DROP TABLE" option when exporting
Need Help?
If you encounter issues with database backups or restores, please contact our support team. Include your database name and any error messages you receive.