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
  • 113 användare blev hjälpta av detta svar
Hjälpte svaret dig?

Related Articles

Remove a Service from ChkServd Monitoring for cPanel Servers

This guide requires root user account in server. In some circumstances, ChkservD cPanel...

Assigning a Dedicated IP Address to a Subdomain using WHM

To assign a dedicated IP address to a subdomain, perform the following steps: Step 1: Add the...

Enable Lets Encrypt AutoSSL Provider

This article refers to cPanel version 84 and later. Enable Let's Encrypt for AutoSSL Follow...

How to Fix Incorrect cPanel Account Quotas and Disk Usage

This article will provide a step-by-step guide to fix incorrect account quotas and disk usage on...

How to Uninstall Installatron in WHM cPanel Server

This guide will show you how to quickly uninstall Installatron software from WHM/cPanel server....