Documentation Home
MySQL Enterprise Backup 3.9 User's Guide
Related Documentation Download this Manual
PDF (US Ltr) - 0.9Mb
PDF (A4) - 0.8Mb

5.2 Performing a Restore Operation

The mysqlbackup options to perform a restore operation are copy-back and copy-back-and-apply-log. The restoration process requires the database server to be already shut down (except for restorations of backups created with the --use-tts option; see explanations below). The process copies the data files, logs, and other backed-up files from the backup directory back to their original locations, and performs any required post-processing on them. For any restore operation, the options datadir, innodb_log_files_in_group, and innodb_log_file_size must be specified either in the target server's configuration file, in the file specified by the --defaults-file option, or as command-line options.

Example 5.4 Shutting Down and Restoring a Database

mysqladmin --user=root --password shutdown
mysqlbackup --defaults-file=/usr/local/mysql/my.cnf \
  --backup-dir=/export/backups/full \


The restored data includes the backup_history table, where MySQL Enterprise Backup records details of each backup. Restoring this table to its earlier state removes information about any subsequent backups that you did. This is the correct starting point for future incremental backups, particularly those using the --incremental-base option.


Before restoring a partial backup, you might need to delete first from the backup the .frm files associated with InnoDB tables that were not backed up. See Section 4.1.9, “Partial Backup Options” and Section, “Backing Up Some or All InnoDB Tables” for details.


When performing a full restore (for example, when the backup data is used to set up a new MySQL server or used to replace all data of an existing MySQL server), make sure the target data directories are all clean, containing no old or unwanted data files. This might require manual removal of files at the locations specified by both the --datadir and --innodb_data_file_path options. The same cleanup is not required for restoring backups created with the--use-tts option, and usually not necessary for restoring a partial backup.

You can combine the apply-log and the copy-back operations (as well as a number of other operations, depending on the kind of backup you are restoring) into a single step by using the copy-back-and-apply-log option instead:

mysqlbackup --defaults-file=/usr/local/mysql/my.cnf \
  --backup-dir=/export/backups/full \

For how to use the copy-back-and-apply-log option for different kinds of restorations, see Section, “Restore an Existing Backup” for details.

Restoring Backups Created with the --use-tts Option

There are some special requirements for restoring backups created with the --use-tts option:

  • The destination server must be running.

  • The destination server must be using the same page size that was used on the server on which the backup was made.

  • The innodb_file_per_table option must be enabled on the destination server.

  • The tables being restored must not exist on the destination server.

  • The copy-back subcommand (NOT the copy-back-and-apply-log option) must be used for the restoration. Take the following steps before performing the copy-back operation:

    • If you are restoring a single-file backup, unpack first the backup image to a directory using the extract or image-to-backup-dir subcommand. Note that you cannot perform a selective extraction of specific tables or directories from a backup image created using the --use-tts option.

    • Perform an apply-log operation to the backup (or, for a single-file backup, to the directory created by unpacking the backup image) to bring it up-to-date.

User Comments
  Posted by Stefan Lasiewski on September 2, 2014
Don't forget, you probably want to do the restore as the user which runs mysql (normally the user named 'mysql') and not as the Unix root user.
Sign Up Login You must be logged in to post a comment.