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
  • 166 Users Found This Useful
Was this answer helpful?

Related Articles

Disable Network Manager on CentOS 7

This article will provide the steps to disable Network Manager in CentOS 7. Network Manager is...

Disable Network Manager on CentOS 6

This article will provide the steps to disable Network Manager in CentOS 6. Network Manager is...

Install MySQL on CentOS 6 Server

This tutorial provides step-by-step instructions for installing MySQL database server on CentOS...

How to Find the IP of cPanel/WHM Server

This tutorial is designed to troubleshoot and diagnose issues with cPanel license errors. Find...

Uninstall WHMXtra on cPanel Server

This article provides a quick and direct guide for uninstalling the WHMXtra plugin from a...