4.2.3. Specifying Program Options Using Options on the Command Line Program Option Modifiers Using Option Files Command-Line Options that Affect Option-File Handling Using Options to Set Program Variables Option Defaults, Options Expecting Values, and the =Sign

There are several ways to specify options for MySQL programs:

Options are processed in order, so if an option is specified multiple times, the last occurrence takes precedence. The following command causes mysql to connect to the server running on localhost:

shell> mysql -h example.com -h

If conflicting or related options are given, later options take precedence over earlier options. The following command runs mysql in "no column names" mode:

shell> mysql --column-names

MySQL programs determine which options are given first by examining environment variables, then by reading option files, and then by checking the command line. This means that environment variables have the lowest precedence and command-line options the highest.

You can take advantage of the way that MySQL programs process options by specifying default option values for a program in an option file. That enables you to avoid typing them each time you run the program while enabling you to override the defaults if necessary by using command-line options.


Prior to MySQL 5.7.2, program options could be specified in full or as any unambiguous prefix. For example, the --compress option could be given to mysqldump as --compr, but not as --comp because the latter is ambiguous. As of MySQL 5.7.2, option prefixes are no longer supported; only full options are accepted. This is because prefixes can cause problems when new options are implemented for programs and a prefix that is currently unambiguous might become ambiguous in the future.

Spec-Zone.ru - all specs in one place