Regular database backups are the safety net every website owner needs. Whether you're migrating to a new host, updating your CMS, or recovering from a hack, having a fresh .sql backup can save your entire business. This guide covers three reliable methods to back up your MySQL database in cPanel.
Method 1 — cPanel Backup Wizard (Easiest)
The Backup Wizard is the simplest option for non-technical users.
- Log in to cPanel.
- Go to Files → Backup Wizard.
- Click Back Up, then select MySQL Databases.
- Choose the database you want to back up.
- Click Generate Backup — a
.sql.gzfile will download to your computer.
Method 2 — Export via phpMyAdmin
- In cPanel, open phpMyAdmin.
- Select your database from the left sidebar.
- Click the Export tab.
- Choose Quick export method and SQL format.
- Click Go — the
.sqlfile will download immediately.
Tip: For large databases, use the Custom export method and enable gzip compression to reduce file size.
Method 3 — mysqldump via SSH (Most Powerful)
This method is best for large databases and automated backups.
mysqldump -u username_dbuser -p username_dbname > ~/backup_$(date +%F).sql
To create a compressed backup:
mysqldump -u username_dbuser -p username_dbname | gzip > ~/backup_$(date +%F).sql.gz
The $(date +%F) appends today's date to the filename automatically (e.g., backup_2025-05-10.sql.gz).
Automating Backups with a Cron Job
Set up a daily automated backup by adding a cron job in cPanel:
- Go to Advanced → Cron Jobs.
- Set the schedule to Once a day.
- Enter the command:
mysqldump -u username_dbuser -pYourPassword username_dbname | gzip > ~/backups/db_$(date +\%F).sql.gz
Security note: Storing the password in a cron command is not ideal. Use a ~/.my.cnf file to store credentials securely.
Where to Store Your Backups
- Never store backups only inside
public_html— they could be publicly accessible. - Download backups to your local computer after each export.
- Use cloud storage (Google Drive, S3, Dropbox) for off-site redundancy.
- Keep at least 30 days of rolling backups for critical databases.
Need help automating your backups or setting up a backup policy? Contact the Flyhost support team — we're happy to assist.