You can specify mysqlbackup options either on the command line or as configuration parameters inside a configuration file. This section describes the use of configuration files.
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
when you run mysqlbackup override the values
from the configuration file, and 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 source repository when it is not
connected to mysqld:
Options other than the ones listed above should be specified under
the [mysqlbackup]
or
[client]
section in the configuration file.
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.
Options Files
mysqlbackup reads the location of the MySQL data to be backed up from the following sources (listed in order of priority):
The connection information from the running database, whenever possible. Thus, in most cases, you can avoid specifying most options on the command line or in a configuration file.
Parameters you specify on the mysqlbackup command line. You can specify certain options for individual backup jobs this way.
The MySQL configuration file (by default,
my.cnf
on Unix andmy.ini
on Windows). The parameters are searched for first under the[mysqlbackup]
group, then under the[client]
group. You can put common parameters that apply to most of your backup jobs into the configuration file.
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 17.1 Example backup-my.cnf
file
Here is an example backup-my.cnf
file
generated by mysqlbackup:
#
# 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
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 minimally required parameters are
stored in backup-my.cnf
, to allow you to
restore the backup to a different environment without having to
make extensive changes to that file. For example, the
innodb_data_home_dir
and
innodb_log_group_home_dir
options are omitted
from the backup-my.cnf
file when their values
are the same as the value for backup-dir
.