Most MySQL programs that support option files handle the following options. Because these options affect option-file handling, they must be given on the command line and not in an option file. To work properly, each of these options must be given before other options, with these exceptions:
--print-defaultsmay be used immediately after--defaults-file,--defaults-extra-file, or--login-path.On Windows, if the server is started with the
--defaults-fileand--installoptions,--installmust be first. See Section 2.3.5.7, “Starting MySQL as a Windows Service”.
When specifying file names, avoid the use of the
~ shell metacharacter because it might not be
interpreted as you expect.
--defaults-extra-file=file_nameRead this option file after the global option file but (on Unix) before the user option file and (on all platforms) before the login path file. (For information about the order in which option files are used, see Section 4.2.6, “Using Option Files”.) If the file does not exist or is otherwise inaccessible, an error occurs.
file_nameis interpreted relative to the current directory if given as a relative path name rather than a full path name.Use only the given option file. If the file does not exist or is otherwise inaccessible, an error occurs.
file_nameis interpreted relative to the current directory if given as a relative path name rather than a full path name.Exception: Even with
--defaults-file, client programs read.mylogin.cnf.Read not only the usual option groups, but also groups with the usual names and a suffix of
str. For example, the mysql client normally reads the[client]and[mysql]groups. If the--defaults-group-suffix=_otheroption is given, mysql also reads the[client_other]and[mysql_other]groups.Read options from the named login path in the
.mylogin.cnflogin path file. A “login path” is an option group containing options that specify which MySQL server to connect to and which account to authenticate as. To create or modify a login path file, use the mysql_config_editor utility. See Section 4.6.6, “mysql_config_editor — MySQL Configuration Utility”. This option was added in MySQL 5.6.6.A client program reads the option group corresponding to the named login path, in addition to option groups that the program reads by default. Consider this command:
shell>
mysql --login-path=mypathBy default, the mysql client reads the
[client]and[mysql]option groups. So for the command shown, mysql reads[client]and[mysql]from other option files, and[client],[mysql], and[mypath]from the login path file.Client programs read the login path file even when the
--no-defaultsoption is used.To specify an alternate login path file name, set the
MYSQL_TEST_LOGIN_FILEenvironment variable.Do not read any option files. If program startup fails due to reading unknown options from an option file,
--no-defaultscan be used to prevent them from being read.The exception is that client programs read the
.mylogin.cnflogin path file, if it exists, even when--no-defaultsis used. This permits passwords to be specified in a safer way than on the command line even if--no-defaultsis present. (.mylogin.cnfis created by the mysql_config_editor utility. See Section 4.6.6, “mysql_config_editor — MySQL Configuration Utility”.)Print the program name and all options that it gets from option files.