Documentation Home
MySQL Enterprise Backup 8.0 User's Guide
Related Documentation Download this Manual
PDF (US Ltr) - 1.2Mb
PDF (A4) - 1.2Mb
HTML Download (TGZ) - 187.2Kb
HTML Download (Zip) - 217.3Kb


4.2.1 Backing Up an Entire MySQL Instance

In the following example, we back up an entire MySQL instance to a single file using the backup-to-image command, which appears at the end of the sample command. We specify some of the connection information for the database using the --user and --host options (and, with the --password option, tell the MySQL server to prompt for a user password). The location and filename for the single-file backup is specified using the --backup-image option, and the location for an empty folder to store temporary files is supplied with the --backup-dir option.

The output echoes all the parameters used by the backup operation, including several that are retrieved automatically using the database connection. The unique ID for this backup job is recorded in special tables that mysqlbackup creates inside the MySQL instance, allowing you to monitor long-running backups and view information on previous backups. The final output section repeats the location of the backup data and provides the LSN values that you might use when you perform an incremental backup next time over the full backup that has just been made.

$ mysqlbackup --user=mysqlbackup --password --host=127.0.0.1 --backup-image=/home/mysqlbackup/backups/my.mbi \
  --backup-dir=/home/mysqlbackup/backup-tmp  backup-to-image
MySQL Enterprise Backup version 8.0.11 Linux-3.8.13-68.3.4.el6uek.x86_64-x86_64 [2018-03-15  14:13:10] 
Copyright (c) 2003, 2018, Oracle and/or its affiliates. All Rights Reserved.

180322 18:37:36 MAIN    INFO: A thread created with Id '139937042728768' 
180322 18:37:36 MAIN    INFO: Starting with following command line ...
 bin/mysqlbackup --user=mysqlbackup --password --host=127.0.0.1 
        --backup-image=/home/mysqlbackup/backups/my.mbi 
        --backup-dir=/home/mysqlbackup/backup-tmp backup-to-image 

180322 18:37:36 MAIN    INFO: 
Enter password: 
180322 18:37:38 MAIN    INFO: No SSL options specified.
180322 18:37:38 MAIN    INFO: MySQL server version is '8.0.11-commercial'
180322 18:37:38 MAIN    INFO: MySQL server compile os version is 'linux-glibc2.12'
180322 18:37:38 MAIN    INFO: SSL/TLS version used for connection is TLSv1.2
180322 18:37:38 MAIN    INFO: Got some server configuration information from running server.

IMPORTANT: Please check that mysqlbackup run completes successfully.
           At the end of a successful 'backup-to-image' run mysqlbackup
           prints "mysqlbackup completed OK!".

180322 18:37:38 MAIN    INFO: KEF target path:'/home/mysqlbackup/backup-tmp/meta/keyring_kef'
180322 18:37:38 MAIN    INFO: TDE Keyring service initialized.
180322 18:37:38 MAIN    INFO: MEB logfile created at /home/mysqlbackup/backup-tmp/meta/MEB_2018-03-22.18-37-38_
image_backup.log

--------------------------------------------------------------------
                       Server Repository Options:
--------------------------------------------------------------------
  datadir                        = /home/admin/bin/mysql-commercial-8.0.11/datadir/
  innodb_data_home_dir           = 
  innodb_data_file_path          = ibdata1:12M:autoextend
  innodb_log_group_home_dir      = /home/admin/bin/mysql-commercial-8.0.11/datadir/
  innodb_log_files_in_group      = 2
  innodb_log_file_size           = 50331648
  innodb_undo_directory          = /home/admin/bin/mysql-commercial-8.0.11/datadir/
  innodb_undo_tablespaces        = 2
  innodb_buffer_pool_filename    = ib_buffer_pool
  innodb_page_size               = 16384
  innodb_checksum_algorithm      = crc32

--------------------------------------------------------------------
                       Backup Config Options:
--------------------------------------------------------------------
  datadir                        = /home/mysqlbackup/backup-tmp/datadir
  innodb_data_home_dir           = /home/mysqlbackup/backup-tmp/datadir
  innodb_data_file_path          = ibdata1:12M:autoextend
  innodb_log_group_home_dir      = /home/mysqlbackup/backup-tmp/datadir
  innodb_log_files_in_group      = 2
  innodb_log_file_size           = 50331648
  innodb_undo_directory          = /home/mysqlbackup/backup-tmp/datadir
  innodb_undo_tablespaces        = 2
  innodb_buffer_pool_filename    = ib_buffer_pool
  innodb_page_size               = 16384
  innodb_checksum_algorithm      = crc32

Backup Image Path = /home/mysqlbackup/backups/my.mbi
180322 18:37:38 MAIN    INFO: Unique generated backup id for this is 15217582589836379

180322 18:37:38 MAIN    INFO: Creating 14 buffers each of size 16777216.
180322 18:37:38 MAIN    INFO: Full Image Backup operation starts with following threads
		1 read-threads    6 process-threads    1 write-threads
180322 18:37:38 MAIN    INFO: Found checkpoint at lsn 19618974.
180322 18:37:38 MAIN    INFO: Starting log scan from lsn = 19618816 at offset = 19612672 and checkpoint = 19618
974 in file /home/admin/bin/mysql-commercial-8.0.11/datadir/ib_logfile0.
180322 18:37:38 RDR1    INFO: A thread created with Id '139936683886336' 
180322 18:37:38 RDR1    INFO: Copying meta file /home/mysqlbackup/backup-tmp/backup-my.cnf.
180322 18:37:38 RDR1    INFO: Copying meta file /home/mysqlbackup/backup-tmp/meta/backup_create.xml.
180322 18:37:38 RLR1    INFO: A thread created with Id '139936625137408' 
180322 18:37:38 PCR3    INFO: A thread created with Id '139936658708224' 
180322 18:37:38 PCR1    INFO: A thread created with Id '139936675493632' 
180322 18:37:38 PCR5    INFO: A thread created with Id '139936650315520' 
180322 18:37:38 WTR1    INFO: A thread created with Id '139936633530112' 
180322 18:37:38 RDR1    INFO: Starting to copy all innodb files...
180322 18:37:38 RDR1    INFO: Copying /home/admin/bin/mysql-commercial-8.0.11/datadir/ibdata1.
180322 18:37:38 PCR4    INFO: A thread created with Id '139936516097792' 
180322 18:37:38 RLP1    INFO: A thread created with Id '139936535668480' 
180322 18:37:38 PCR6    INFO: A thread created with Id '139936641922816' 
180322 18:37:38 PCR2    INFO: A thread created with Id '139936667100928' 
180322 18:37:38 RLW1    INFO: A thread created with Id '139936544061184' 
180322 18:37:39 RDR1    INFO: Copying /home/admin/bin/mysql-commercial-8.0.11/datadir/undo_001.
180322 18:37:39 RDR1    INFO: Copying /home/admin/bin/mysql-commercial-8.0.11/datadir/undo_002.
180322 18:37:39 RDR1    INFO: Copying /home/admin/bin/mysql-commercial-8.0.11/datadir/sys/sys_config.ibd.
180322 18:37:39 RDR1    INFO: Copying /home/admin/bin/mysql-commercial-8.0.11/datadir/pets/cats.ibd.
180322 18:37:39 RDR1    INFO: Copying /home/admin/bin/mysql-commercial-8.0.11/datadir/mysql.ibd.
180322 18:37:39 RDR1    INFO: Completing the copy of innodb files.
180322 18:37:39 RDR1    INFO: Requesting a dump of the InnoDB buffer pool
180322 18:37:39 RDR1    INFO: Waiting for the dump of the InnoDB buffer pool to complete
180322 18:37:39 RDR1    INFO: The dump of the InnoDB buffer pool completed
180322 18:37:39 RDR1    INFO: Starting to copy Binlog files...
180322 18:37:39 RDR1    INFO: Copying /home/admin/bin/mysql-commercial-8.0.11/datadir/binlog.000001.
180322 18:37:39 RDR1    INFO: Preparing to lock tables: Connected to mysqld server.
180322 18:37:39 RDR1    INFO: Starting to lock all the tables...
180322 18:37:39 RDR1    INFO: Flushing the default MyISAM key cache.
180322 18:37:39 RDR1    INFO: All tables are locked and flushed to disk
180322 18:37:39 RDR1    INFO: Using checkpoint 19618974 
180322 18:37:39 RDR1    INFO: Copying /home/admin/bin/mysql-commercial-8.0.11/datadir/binlog.000002.
180322 18:37:39 RDR1    INFO: Completed the copy of binlog files...
180322 18:37:39 RDR1    INFO: Opening backup source directory '/home/admin/bin/mysql-commercial-8.0.11/datadir'
180322 18:37:39 RDR1    INFO: Starting to backup all non-innodb files in 
	subdirectories of '/home/admin/bin/mysql-commercial-8.0.11/datadir'
180322 18:37:39 WTR1    INFO: Adding database directory: datadir/mysql
180322 18:37:39 WTR1    INFO: Adding database directory: datadir/performance_schema
180322 18:37:39 RDR1    INFO: Completing the copy of all non-innodb files.
180322 18:37:39 WTR1    INFO: Adding database directory: datadir/pets
180322 18:37:39 WTR1    INFO: Adding database directory: datadir/sys
180322 18:37:39 RDR1    INFO: Requesting completion of redo log copy. Rapid: 0
180322 18:37:39 RLR1    INFO: Signaled '1' to complete log copy.
180322 18:37:39 RLR1    INFO: Signaled '1' to complete log copy.
180322 18:37:39 RLR1    INFO: Signaled '1' to complete log copy.
180322 18:37:39 RLR1    INFO: Redo log reader waited = 0.00 ms for logs to generate.
180322 18:37:39 RLW1    INFO: A copied database page was modified at 19618974.
          (This is the highest lsn found on page)
          Scanned log up to lsn 19618974.
          Was able to parse the log up to lsn 19618974.
180322 18:37:40 RDR1    INFO: All tables unlocked
180322 18:37:40 RDR1    INFO: All MySQL tables were locked for 1.115 seconds.
180322 18:37:40 RDR1    INFO: Reading all global variables from the server.
180322 18:37:40 RDR1    INFO: Completed reading of all global variables from the server.
180322 18:37:40 RDR1    INFO: Writing config file for server '8.0.11-commercial'.
180322 18:37:40 RDR1    INFO: Creating server config files server-my.cnf and server-all.cnf in /home/mysqlbacku
p/backup-tmp
180322 18:37:40 RDR1    INFO: Copying meta file /home/mysqlbackup/backup-tmp/meta/backup_variables.txt.
180322 18:37:40 RDR1    INFO: Copying meta file /home/mysqlbackup/backup-tmp/datadir/ibbackup_logfile.
180322 18:37:40 RDR1    INFO: Copying meta file /home/mysqlbackup/backup-tmp/server-all.cnf.
180322 18:37:40 RDR1    INFO: Copying meta file /home/mysqlbackup/backup-tmp/server-my.cnf.
180322 18:37:40 RDR1    INFO: Copying meta file /home/mysqlbackup/backup-tmp/meta/backup_content.xml.
180322 18:37:40 RDR1    INFO: Copying meta file /home/mysqlbackup/backup-tmp/meta/image_files.xml.
180322 18:37:40 MAIN    INFO: Full Image Backup operation completed successfully.
180322 18:37:40 MAIN    INFO: Backup image created successfully.
180322 18:37:40 MAIN    INFO: Image Path = /home/mysqlbackup/backups/my.mbi
180322 18:37:40 MAIN    INFO: MySQL binlog position: filename binlog.000002, position 3980

-------------------------------------------------------------
   Parameters Summary         
-------------------------------------------------------------
   Start LSN                  : 19618816
   End LSN                    : 19618974
-------------------------------------------------------------

mysqlbackup completed OK!

User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.