4.2 Configuration Files and Parameters

4.2.1 Source Repository Parameters
4.2.2 Backup Repository Parameters
4.2.3 Other Parameters

You can specify many mysqlbackup options either on the command line or as configuration parameters inside a configuration file. This section describes the use of configuration files and the meanings of the configuration options. For options that are typically specified on the command line, the primary descriptions and examples are in Section 4.1, “mysqlbackup Command-Line Options”.

In general, mysqlbackup follows the mysql style of processing configuration options: [mysqlbackup] and [client] group options are passed as command-line options. Any command-line options that you specify override the values from the configuration file, and in the case of duplicate options, the last instance takes precedence. mysqlbackup also reads options in the [mysqld] group to detect parameters related to the source repository when no connection to mysqld is available.

Options Files

The mysqlbackup command reads the location of the MySQL data to back up from (in order of priority):

Because mysqlbackup does not overwrite any files during the initial backup step, the backup directory must not contain any old backup files. mysqlbackup stops when asked to create a file that already exists, to avoid harming an existing backup. For convenience, specify the --with-timestamp option, which always creates a unique timestamped subdirectory for each backup job underneath the main backup directory.

Configuration Files Stored with the Backup Data

Each set of backup data includes a configuration file, backup-my.cnf, containing a minimal set of configuration parameters. The mysqlbackup command generates this file to record the settings that apply to this backup data. Subsequent operations, such as the apply-log process, read options from this file to determine how the backup data is structured.

Example 4.5 Example backup-my.cnf file

Here is an example backup-my.cnf file generated by mysqlbackup:


All paths in the generated backup-my.cnf file point to a single backup directory. For ease of verification and maintenance, you typically store all data for a backup inside a single directory rather than scattered among different directories.

During a backup, the configuration parameters that are required for later stages (such as the restore operation) are recorded in the backup-my.cnf file that is generated in the backup directory. Only the minimal required parameters are stored in backup-my.cnf, to allow you to restore the backup to a different location without extensive changes to that file. For example, although the innodb_data_home_dir and innodb_log_group_home_dir options can go into backup-my.cnf, they are omitted when those values are the same as the backup-dir value.