Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to back up a MySQL database

This guide shows you how to save a copy of your database so you can restore it if something goes wrong.

Databases2 min read11 steps1 screenshots

Why back up?

A database is where your website keeps its data. If it breaks or gets deleted, your site loses its content. A backup is a spare copy. Make one before big changes, such as updates or moving your site.

A MySQL backup is usually a file that ends in .sql. It holds the commands needed to rebuild your data.

Way 1: phpMyAdmin

phpMyAdmin is a web tool for databases. You open it from cPanel.

  1. Log in to your client area. Open your hosting service and log in to cPanel.
  2. Under Databases, click phpMyAdmin.
  3. Click your database name on the left.
  4. Click the Export tab.
  5. Keep Quick as the method and SQL as the format.
    export
  6. Click Go.
  7. Your browser downloads a .sql file. Keep it safe.

Way 2: cPanel Backup tool

  1. In cPanel, under Files, click Backup.
  2. Find Download a MySQL Database Backup.
  3. Click the name of your database.
  4. The file downloads to your computer.

Way 3: command line

If you have SSH access, you can use the mysqldump tool. SSH is a safe way to type commands on a remote server.

mysqldump -u username -p dbname > backup.sql

This reads the database named dbname and saves it to backup.sql. It asks for the password first.

Restoring a backup

In phpMyAdmin, choose the database, click the Import tab, pick your file and click Go.

Warning: Importing can overwrite current data. Be sure you want to replace it.

Tip: Keep a copy of the backup away from your server, such as on your computer. Name files with the date, like shop-2025-01-15.sql. Back up on a regular schedule.

Quick recap

  • A backup is a .sql file with your data.
  • Use phpMyAdmin Export, the cPanel Backup page, or mysqldump.
  • Store copies in more than one place.
  • Back up before updates and changes.