MySQL Enterprise Backup 8.4 User's Guide  /  mysqlbackup Command Reference  /  Configuration Files and Parameters

Chapter 21 Configuration Files and Parameters

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 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 a non-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 a mysqlbackup option name, dashes (-) and underscores (_) may usually be used interchangeably, similar to mysqld parameters that use this same convention (notice that log-bin is one exception; 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.

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 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.

Configuration Files Stored Inside the Backups

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.

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).