How to Backup MySQL Databases

This guide provides the steps required to make a backup or restore a backup of a MySQL or MariaDB database.

Create Backup of MySQL Database

This example shows you how to export a database. It is a good idea to export your data often as a backup in preparation for possible Disaster Recovery scenario.

Replace [username], [password] and [database_name] with your MySQL username, password and database name.

File FILE.sql now holds a backup of your database. You may download it to your local computer.

Restore Backup of MySQL Database

Here, we will import a database. These steps can be used to restore a database to previous version from backup or to import a database from an external source MySQL server.

  • Login to your server as root user.
  • Run the following command:
    # mysql -u [username] -p [password] [database_name] < FILE.sql

Replace [username], [password] and [database_name] with your MySQL username, password and database name.

The FILE.sql is now imported into MySQL.

  • database, backups, cpanel, mysql, mariadb, mysql cli, restore backup
  • 6 Users Found This Useful
Was this answer helpful?

Related Articles

 Create Spam Filters for Mailing Lists

This document explains how to create mail filter rules in cPanel's Mailing Lists interface (Home...

 Video: Create Email Filter in cPanel

This video tutorial provides Step-by-Step instructions for creating an email filter in cPanel...

 Video: Using Webmail in cPanel

This video tutorial provides Step-by-Step instructions for using Webmail in cPanel Shared Hosting...

 Video: Change cPanel Style

This video tutorial provides Step-by-Step instructions for changing the Style settings in cPanel...

 Video: Managing Directory Privacy in cPanel

This video tutorial provides Step-by-Step instructions for managing Directory Privacy within a...

Powered by WHMCompleteSolution