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:

  1. Log into cPanel and click phpMyAdmin under Databases
  2. Select your database from the left sidebar
  3. Click the Export tab at the top
  4. Choose export method:
    • Quick - Uses default settings (recommended for most users)
    • Custom - Allows you to customize export options
  5. Ensure format is set to SQL
  6. 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:

  1. In cPanel, go to FilesBackup Wizard
  2. Click Backup
  3. Select Partial Backup
  4. Click the database you want to backup under MySQL Databases
  5. 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

  1. Open phpMyAdmin in cPanel
  2. Select your database from the left sidebar
  3. Click the Import tab
  4. Click Choose File and select your backup .sql file
  5. Leave default settings (Format: SQL)
  6. 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

  1. Go to FilesBackup Wizard
  2. Click Restore
  3. Select MySQL Databases
  4. Click Choose File and select your backup
  5. 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:

  1. Go to Softaculous Apps Installer in cPanel
  2. Click All Installations
  3. Click the pencil (edit) icon next to your installation
  4. Scroll to Backup Settings
  5. Enable Automated Backups and set frequency
  6. Choose backup rotation (how many backups to keep)
  7. 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.

Was this answer helpful? 0 Users Found This Useful (0 Votes)