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. 大多数支持选项文件的MySQL程序都处理以下选项。因为这些选项会影响选项文件的处理,所以它们必须在命令行中给出,而不是在选项文件中。To work properly, each of these options must be given before other options, with these exceptions:为了正常工作,必须先给出这些选项中的每一个,然后再给出其他选项,但以下情况除外:
--print-defaults
may be used immediately after --defaults-file
, --defaults-extra-file
, or --login-path
.
On Windows, if the server is started with the --defaults-file
and --install
options, --install
must be first. See Section 2.3.4.8, “Starting MySQL as a Windows Service”.
When specifying file names as option values, avoid the use of the 将文件名指定为选项值时,请避免使用~
shell metacharacter because it might not be interpreted as you expect.~
外壳元字符,因为它可能无法按预期进行解释。
--defaults-extra-file=
file_name
Read 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. 在全局选项文件之后读取此选项文件,但(在Unix上)在用户选项文件之前读取,(在所有平台上)在登录路径文件之前读取。(For information about the order in which option files are used, see Section 4.2.2.2, “Using Option Files”.) (有关选项文件使用顺序的信息,请参阅第4.2.2.2节,“使用选项文件”。)If the file does not exist or is otherwise inaccessible, an error occurs. 如果文件不存在或无法访问,则会发生错误。If 如果file_name
is not an absolute path name, it is interpreted relative to the current directory.file_name
不是绝对路径名,则会相对于当前目录进行解释。
See the introduction to this section regarding constraints on the position in which this option may be specified.请参阅本节的介绍,了解可指定此选项的位置的约束条件。
Read only the given option file. If the file does not exist or is otherwise inaccessible, an error occurs. 只读给定的选项文件。如果文件不存在或无法访问,则会发生错误。如果指定为相对路径名而不是完整路径名,则file_name
is interpreted relative to the current directory if given as a relative path name rather than a full path name.file_name
将相对于当前目录进行解释。
Exceptions: Even with --defaults-file
, mysqld reads mysqld-auto.cnf
and client programs read .mylogin.cnf
.
See the introduction to this section regarding constraints on the position in which this option may be specified.请参阅本节的介绍,了解可指定此选项的位置的约束条件。
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 this option is given as --defaults-group-suffix=_other
, mysql also reads the [client_other]
and [mysql_other]
groups.
Read options from the named login path in the .mylogin.cnf
login 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.7, “mysql_config_editor — MySQL Configuration Utility”.
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:客户端程序读取与命名登录路径对应的选项组,以及程序默认读取的选项组。考虑以下命令:
mysql --login-path=mypath
By 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-defaults
option is used.--no-defaults
选项,客户端程序也会读取登录路径文件。
To specify an alternate login path file name, set the 要指定备用登录路径文件名,请设置MYSQL_TEST_LOGIN_FILE
environment variable.MYSQL_TEST_LOGIN_FILE
环境变量。
See the introduction to this section regarding constraints on the position in which this option may be specified.请参阅本节的介绍,了解可指定此选项的位置的约束条件。
Do not read any option files. 不要读取任何选项文件。If program startup fails due to reading unknown options from an option file, 如果由于从选项文件中读取未知选项而导致程序启动失败,则使用--no-defaults
can be used to prevent them from being read.--no-defaults
可以阻止读取这些选项。
The exception is that client programs read the 例外情况是,客户端程序读取.mylogin.cnf
login path file, if it exists, even when --no-defaults
is used. .mylogin.cnf
登录路径文件(如果存在),即使使用了--no-defaults
。This permits passwords to be specified in a safer way than on the command line even if 这允许以比在命令行上更安全的方式指定密码,即使存在--no-defaults
is present. --no-defaults
。To create 要创建.mylogin.cnf
, use the mysql_config_editor utility. .mylogin.cnf
,请使用mysql_config_editor实用程序。See Section 4.6.7, “mysql_config_editor — MySQL Configuration Utility”.请参阅第4.6.7节,“mysql_config_editor-mysql配置实用程序”。
Print the program name and all options that it gets from option files. Password values are masked.打印程序名称及其从选项文件中获得的所有选项。密码值被屏蔽。
See the introduction to this section regarding constraints on the position in which this option may be specified.请参阅本节的介绍,了解可指定此选项的位置的约束条件。