This is the syntax to use when performing a backup, the most
frequent kind of operation, and the most flexible with various
options such as --compress and
--incremental. For usage
information and examples, see
Section 3.3, “Backup Scenarios and Examples”.
mysqlbackup [STD-OPTIONS] [CONNECTION-OPTIONS] [SERVER-REPOSITORY-OPTIONS] [BACKUP-REPOSITORY-OPTIONS] [--sleep=MS] [--compress] [--compress-level=LEVEL] [--include=REGEXP] [--with-timestamp] [--slave-info] [--databases=LIST] [--databases-list-file=PATH] [--suspend-at-end] [--exec-when-locked="utilityarg1arg2..."] [ {--incremental|--incremental-with-redo-log-only} {--incremental-base=dir:|directory_path--incremental-base=history:last_backup|--start-lsn=}LSN--incremental-backup-dir=] [PATH--only-known-file-types] [--only-innodb|--only-innodb-with-frm] [--no-history-logging] [--no-locking] [--backup-dir=PATH] [--backup-image=IMAGE] [--comments=COMMENTS-STRING] [--comments-file=PATH] [--number-of-buffers=num_buffers] [--read-threads=num_threads] [--process-threads=num_threads] [--write-threads=num_threads] [--limit-memory=MB] [--sbt-database-name=NAME] [--sbt-lib-path=PATH] [--sbt-environment=VAR=value,...]backup|backup-and-apply-log|backup-to-image
backup-to-image
Produces a single-file backup rather than a directory
structure holding the backup files. Requires the
--backup-image option to
specify the destination file. Can be used to stream the
backup to a storage device or another system without ever
storing the data on the database server. You can specify
--backup-image=-, representing
standard output, allowing the output to be piped to
another command. To avoid mixing normal informational
messages with backup output, the --help
message, errors, alerts, and normal informational messages
are always printed to standard error.
Example 4.1. Simple Backup with Connection Parameters from Default Configuration File
The following example shows a minimal backup with the
mysqlbackup command, with any necessary
connection parameters for the database in the
[mysqlbackup section of the default MySQL
configuration file:
mysqlbackup --backup-dir=/export/backups/latest backup
Example 4.2. Basic Incremental Backup
mysqlbackup --incremental --start-lsn=12345 --incremental-backup-dir=/path/to/incbackup backup
There is a separate directory dedicated to incremental
backup. Both this directory and the one for full backups can
be specified in the my.cnf file, and
the appropriate directory is used depending on the type of
backup. Both the incremental backup data and an earlier full
backup are needed to do a successful restore operation.