How to restore MySQL database from backup?

This article contains information on how to restore the MySQL database from a backup.

How to restore the MySQL database from the backup?

The first thing, you need to do to restore the MySQL database from the backup is to restore the database files from the storage to the temporary directory, from which these will be imported to the MySQL database environment.

Read the following article to get information on how to restore files backed up using a file-level backup plan.

File-level backup recovery

If you backed up your database using the image-level backup, use the granular access to the image-level backup using the following article:

Granular Recovery Of Files & Folders - iSCSI Restore

Xopero recommends restoring the database files to the original directory! The reason for this is the possibility of problems with permissions to another location.

The next thing you need to do, when the database files are restored, is to import these files to the MySQL environment. In order to restore the database to the MySQL server, use the database management tool. For the purposes of this manual, the MySQL utility from the command line was used.

The mysql utility is available for download at:

In order to restore the database, log in to the database server using the command:

mysql -h SERVER_ADDRESS -u USER -p


  • SERVER_ADDRESS - MySQL server address to which it is to be added.

  • USER - database user's username

Next, type:



  • DATABASE_NAME - name of the database, to which the database dump file have to be restored.

If the corrupted database still exists in the MySQL environment, first you need to drop it and create the database again using the following command:



  • DATABASE_NAME - name of the database, which should be created, to import the database dump file into it in the next step.

After the new database creation, use the USE DATABASE_NAME command (described above).

The database backup is restored using the SOURCE PATH_TO_FILE command, where in place of PATH_TO_FILE the exact location of the previously restored database file should be indicated. It has the following syntax:


Last updated