Restores the data files from a backup to their original
locations within the database server. The MySQL instance must
be shut down first before a restore operation. The options
be specified either in the target server's configuration file,
in the file specified by the
--defaults-file option, or as
command-line options. For usage and examples, see
Chapter 4, Recovering or Restoring a Database.
mysqlbackup [STD-OPTIONS] [SERVER-REPOSITORY-OPTIONS] [--backup-dir=PATH] [MESSAGE-LOGGING-OPTIONS] [PARTIAL-BACKUP-RESTORE-OPTIONS] [PROGRESS-REPORT-OPTIONS] [CLOUD-STORAGE-OPTIONS] copy-back mysqlbackup [STD-OPTIONS] [SERVER-REPOSITORY-OPTIONS] [--backup-image=IMAGE] [--backup-dir=PATH] [MESSAGE-LOGGING-OPTIONS] [PARTIAL-BACKUP-RESTORE-OPTIONS] [PROGRESS-REPORT-OPTIONS] [ENCRYPTION-OPTIONS] [CLOUD-STORAGE-OPTIONS] copy-back-and-apply-log
Some clean-up efforts on the target directory for restoration might be needed before 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). See Section 4.2, “Performing a Restore Operation” for details.
There are some special requirements when restoring backups created with the
--use-ttsoption; see Restoring Backups Created with the --use-tts Option for details.
In a single step, restores a single-file backup specified by the
--backup-imageoption or a backup from the directory specified by the
--backup-diroption to a server's data directory and performs an
apply-logoperation to the restored data to bring them up-to-date. Comparing with a multi-step approach for restoring a single-file backup (which typically consists of performing the successive steps of extract, uncompress ,apply-log, and copy-back for restoring compressed image, or extract ,apply-log, and copy-back for uncompressed image), the option makes the restoration process simpler and faster, and also saves the disk space required.
The following are some special requirements for different kinds of backup restoration using
To restore a compressed directory or image, include the
--uncompressoption in the command line.
To restore a single-file backup, besides specifying the location of the backup image with the
--backup-imageoption, also supply with the
--backup-diroption the location of a folder that will be used for storing temporary files produced during the restoration process.
To restore an incremental backup directory, assuming the full backup (on which the incremental backup was based) has already been restored:
To restore a single-file incremental backup, besides specifying the location of the incremental backup image with the
--backup-imageoption, also supply with the
--incremental-backup-diroption the location of a folder that will be used for storing temporary files produced during the restoration process.
To restore a backup created with the
See the general requirements described in Restoring Backups Created with the --use-tts Option.
When restoring an image backup created with the option setting
with-minimum-locking, also supply with the
--backup-diroption the location of a folder that will be used for extracting temporarily all tables in the backup and for performing an
apply-logoperation to make the data up-to-date before restoring them to the server's data directory.
When restoring a backup directory created with the option
apply-logoperation will be performed on the backup directory. That means the backup taken will be altered during the process, and users might want to make an extra copy of the backup directory before proceeding with the restoration, in order to prevent the loss of backup data in case something goes wrong.
Also note that:
For image backups taken with MySQL Enterprise Backup 3.8.2 or earlier, per-table
.ibdfiles pointed to by
.islfiles in a backup are restored by
copy-back-and-apply-logto the server's data directory rather than the locations pointed to by the .isl files.
Due to a known issue, when restoring a compressed backup created with MySQL Enterprise Backup 3.9 or earlier and containing any InnoDB tables that were created on the server as compressed tables (by using the
KEY_BLOCK_SIZE=option, or both), do not use
copy-back-and-apply-log; instead, perform an
apply-logfirst, and then a
copy-back. See entry for Bug# 17992297 in the MySQL Enterprise Backup 3.10.0 changelog for details.
At the end of the
copy-back-and-apply-logoperation, the file
backup_variables.txtis being created or updated in the data directory. This file contains metadata about the restored contents and is being used by successive single-step restores of incremental backups; it should not be deleted or modified by users.
When restoring a server for
if the backed-up server has used the
to put the undo logs outside of the data directory, when
using the file
server-all.cnf for the
--defaults-file option with
should be taken to configure correctly the
in the file. Otherwise, the data or log files on the
original server might be overwritten by accident.