MySQL Enterprise Backup User's Guide (Version 8.0.23)
You can specify mysqlbackup options either on the command line or as configuration parameters inside a configuration file.
mysqlbackup looks for and reads MySQL
configuration files as mysqld does (see
explanations in Using Option Files). You can also
supply a configuration file to mysqlbackup
using the --defaults-file
option.
In general, mysqlbackup follows the
mysql
style of processing configuration
options: [mysqlbackup]
and
[client]
group options listed in a
configuration file are passed as command-line options. Any
command-line options that you specify when you run
mysqlbackup override the values from the
configuration file. In the case of duplicate options, the last
instance takes precedence. mysqlbackup also
reads options in the [mysqld]
group in the
configuration file to detect parameters related to the source
repository when it is not connected to mysqld
(for example, when restoring a
non-TTS backup).
Within mysqlbackup option names, dashes
(-
) and underscores (_
) may be used
interchangeably, similar to mysqld parameters
that use this same convention (see
Using Options on the Command Line in the MySQL Reference
Manual for details). The MySQL server's reference manual typically
lists the parameter names with underscores, to match the output of
the SHOW VARIABLES
statement.
mysqlbackup reads the locations of the MySQL data (data files, logs, etc.) to be backed up or restored from the following sources:
For backup operations and partial restore operations, the information is retrieved from mysqld.
For non-partial restore operations, the information is supplied to mysqlbackup as parameters through:
The mysqlbackup command line, as command-line options.
A configuration file (see explanation above at the
beginning of the chapter). The parameters are read first
under the [mysqlbackup]
group, then
under the [client]
group, and finally
under the [mysqld]
group. You can put
common connection parameters used for restore operations
(for example, user login, host name, etc.) into the
configuration file.
Each set of backup data includes a configuration file,
backup-my.cnf
, containing a set of
configuration parameters. The mysqlbackup
command generates this file to record the settings that apply to
the backup data. Here is a sample
backup-my.cnf
file generated by
mysqlbackup:
Example 21.1 Sample backup-my.cnf
file
# # Generated backup-my.cnf file. # Auto generated by mysqlbackup program. # [mysqld] innodb_data_file_path=ibdata1:12M:autoextend innodb_log_file_size=50331648 innodb_log_files_in_group=2 innodb_page_size=16384 innodb_checksum_algorithm=crc32 innodb_buffer_pool_filename=ib_buffer_pool innodb_undo_tablespaces=2
All file paths contained in the generated
backup-my.cnf
are relative to the data
directory under the backup
directory.
These configuration parameters are read by
mysqlbackup during operations like
apply-log
, in which the parameters are read from
this file to determine how the backup data is structured. These
parameters can also be used in a restore to compare the InnoDB
settings of the target server with those of the backed-up server,
so that any necessary adjustments can be made; see
Starting the Restored Server for details. Only the
minimally-required parameters are stored in
backup-my.cnf
: for example, the
innodb_data_home_dir
and
innodb_log_group_home_dir
options are omitted
from the backup-my.cnf
file when they just
point to the data directory under the
backup directory
(backup-dir/datadir
usually).