You can specifymysqlbackup options either on the command line or as configuration parameters inside a configuration file.
mysqlbackup looks for and reads MySQL configuration files asmysqld does (see explanations inUsing Option Files). You can also supply a configuration file tomysqlbackup using the--defaults-file option. In general,mysqlbackup follows themysql 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 runmysqlbackup override the values from the configuration file. In the case of duplicate options, the last instance takes precedence.
mysqlbackup also reads the following options in the[mysqld] group in the configuration file to detect parameters related to the server when it is not connected to it (for example, when restoring anon-TTS backup):
If any of these options is also specified in the[mysqlbackup] section, the value there takes precedence over the value in the[mysqld] section. Options other than the ones listed above should be specified under the[mysqlbackup] or[client] section.
Within amysqlbackup option name, dashes (-) and underscores (_) may usually be used interchangeably, similar tomysqld parameters that use this same convention (notice thatlog-bin is one exception; seeUsing 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 theSHOW VARIABLES statement.
Server Data Locations and Options Files
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 frommysqld.
For non-partial restore operations, the information is supplied tomysqlbackup as parameters through:
Themysqlbackup 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.
Configuration Files Stored Inside the Backups
Each set of backup data includes a configuration file,backup-my.cnf, containing a set of configuration parameters. Themysqlbackup command generates this file to record the settings that apply to the backup data. Here is a samplebackup-my.cnf file generated bymysqlbackup:
Example 21.1 Samplebackup-my.cnf file
## Generated backup-my.cnf file.# Auto generated by mysqlbackup program.#[mysqld]innodb_data_file_path=ibdata1:12M:autoextendinnodb_page_size=16384innodb_checksum_algorithm=crc32innodb_buffer_pool_filename=ib_buffer_poolinnodb_undo_tablespaces=2 All file paths contained in the generatedbackup-my.cnf are relative to the data directory under thebackup directory.
These configuration parameters are read bymysqlbackup during operations likeapply-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; seeStarting the Restored Server for details. Only the minimally-required parameters are stored inbackup-my.cnf: for example, theinnodb_data_home_dir andinnodb_log_group_home_dir options are omitted from thebackup-my.cnf file when they just point to the data directory under thebackup directory (backup-dir/datadir usually).