4.1.3 Connection Options

When mysqlbackup creates a backup, it sends SQL commands to MySQL server using a database connection. The general connection details are the same as described in Connecting to the MySQL Server in the MySQL Reference Manual.

As part of the mysqlbackup invocation, specify the appropriate --user, --password, --port, and/or --socket options that are necessary to connect to the MySQL server.

You can specify the following connection-specific options in the [mysqlbackup] or [client] sections of a MySQL configuration file, or through mysqlbackup command-line options. mysqlbackup reads your default configuration files and then the my.cnf file specified on the command line. mysqlbackup reads only --user, --password, --port, and --socket options from the [client] group, and ignores any other options. If you do not provide a value for the --password, the command prompts for one from the keyboard.

Options Common to mysqld
========================
--port=port-num
--protocol=tcp|socket|pipe|memory
--pipe [ alias for --protocol=pipe ]
--user=name [ short option: -u ]
--host=hostname
--socket=name
--shared-memory-base-name=value [Windows only]
--character-sets-dir=PATH
--default-character-set=VALUE
--secure-auth [ Don't connect to pre-4.1.1 server ]
--password[=value]  [ short option: -p ]
--connect_timeout

Connection Options Specific to mysqlbackup
==========================================
--no-connection
--connect-if-online

Most other connection parameters used by the mysql command (such as those starting with ssl) are recognized, but silently ignored. Unknown connection parameters cause the mysqlbackup command to stop.

The --no-connection option supersedes the other connection options and uses file-level operations to perform the backup. When you use this option, you must specify in the configuration file or on the command line many options whose values are normally retrieved automatically through the database connection.

This option also turns on the --no-history-logging and --no-locking options, which might result in inconsistencies in non-InnoDB data if those tables are modified during the backup operation.

By default, a database connection is used for backup operations both during the initial stage to retrieve source repository configuration, and to lock tables while copying non-InnoDB data. This option allows mysqlbackup to attempt the connection attempt in both phases, but continues even if the connection cannot be established. If a connection cannot be established, the processing is the same as with the --no-connection option. This option can be useful in emergency situations, for example if the database server goes down during the backup operation.