This section lists environment variables that are used directly or indirectly by MySQL. Most of these can also be found in other places in this manual.本节列出MySQL直接或间接使用的环境变量。其中大部分内容也可以在本手册的其他地方找到。
Options on the command line take precedence over values specified in option files and environment variables, and values in option files take precedence over values in environment variables. 命令行上的选项优先于选项文件和环境变量中指定的值,选项文件中的值优先于环境变量中的值。In many cases, it is preferable to use an option file instead of environment variables to modify the behavior of MySQL. See Section 4.2.2.2, “Using Option Files”.在许多情况下,最好使用选项文件而不是环境变量来修改MySQL的行为。请参阅第4.2.2.2节,“使用选项文件”。
Variable | |
---|---|
AUTHENTICATION_LDAP_CLIENT_LOG | |
AUTHENTICATION_PAM_LOG | PAM |
CC | |
CXX | |
CC | |
DBI_USER | |
DBI_TRACE | |
HOME | $HOME/.mysql_history .$HOME/.mysql_history 。 |
LD_RUN_PATH | libmysqlclient.so .libmysqlclientso 的位置。 |
LIBMYSQL_ENABLE_CLEARTEXT_PLUGIN | mysql_clear_password authentication plugin; see Section 6.4.1.4, “Client-Side Cleartext Pluggable Authentication”.mysql_clear_password 身份验证插件;请参阅第6.4.1.4节,“客户端明文可插拔身份验证”。 |
LIBMYSQL_PLUGIN_DIR | |
LIBMYSQL_PLUGINS | |
MYSQL_DEBUG | |
MYSQL_GROUP_SUFFIX | --defaults-group-suffix ).--defaults-group-suffix )。 |
MYSQL_HISTFILE | $HOME/.mysql_history .$HOME/.mysql_history 的默认值。 |
MYSQL_HISTIGNORE | $HOME/.mysql_history , or syslog if --syslog is given.$HOME/.mysql_history 或syslog(如果给出--syslog )的语句的模式。 |
MYSQL_HOME | my.cnf file resides.my.cnf 文件所在目录的路径。 |
MYSQL_HOST | |
MYSQL_OPENSSL_UDF_DH_BITS_THRESHOLD | create_dh_parameters() . create_dh_parameters() 的最大键长。 |
MYSQL_OPENSSL_UDF_DSA_BITS_THRESHOLD | create_asymmetric_priv_key() . See Section 6.6.2, “MySQL Enterprise Encryption Usage and Examples”.create_asymmetric_priv_key() 的最大DSA密钥长度。请参阅第6.6.2节,“MySQL企业加密用法和示例”。 |
MYSQL_OPENSSL_UDF_RSA_BITS_THRESHOLD | create_asymmetric_priv_key() . create_asymmetric_priv_key() 的最大RSA密钥长度。 |
MYSQL_PS1 | |
MYSQL_PWD | |
MYSQL_TCP_PORT | |
MYSQL_TEST_LOGIN_FILE | .mylogin.cnf login path file..mylogin.cnf 登录路径文件的名称。 |
MYSQL_TEST_TRACE_CRASH | |
MYSQL_TEST_TRACE_DEBUG | |
MYSQL_UNIX_PORT | localhost .localhost 。 |
MYSQLX_TCP_PORT | |
MYSQLX_UNIX_PORT | localhost .localhost 。 |
NOTIFY_SOCKET | |
PATH | |
PKG_CONFIG_PATH | mysqlclient.pc pkg-config file. See note following table.mysqlclient.pc pkg-config文件的位置。见下表注释。 |
TMPDIR | |
TZ | |
UMASK | |
UMASK_DIR | |
USER |
For information about the mysql history file, see Section 4.5.1.3, “mysql Client Logging”.有关mysql历史文件的信息,请参阅第4.5.1.3节,“mysql客户端日志记录”。
Use of 使用MY_RESPWD指定MYSQL密码必须被视为极其不安全,不应使用。MYSQL_PWD
to specify a MySQL password must be considered extremely insecure and should not be used. Some versions of ps include an option to display the environment of running processes. ps的某些版本包含一个显示运行进程环境的选项。On some systems, if you set 在某些系统上,如果您设置了MYSQL_PWD
, your password is exposed to any other user who runs ps. Even on systems without such a version of ps, it is unwise to assume that there are no other methods by which users can examine process environments.MY_RESPWD
,您的密码将暴露给运行ps
的任何其他用户。即使在没有这种ps
版本的系统上,假设用户没有其他方法可以检查流程环境也是不明智的。
MYSQL 8.0版本已弃用MYSQL_PWD
is deprecated as of MySQL 8.0; expect it to be removed in a future version of MySQL.MYSQL_PWD
;预计它将在MySQL的未来版本中被删除。
MYSQL_TEST_LOGIN_FILE
is the path name of the login path file (the file created by mysql_config_editor). MYSQL_TEST_LOGIN_FILE
是登录路径文件(由mysql_config_editor创建的文件)的路径名。If not set, the default value is 如果未设置,则默认值在Windows上为%APPDATA%\MySQL\.mylogin.cnf
directory on Windows and $HOME/.mylogin.cnf
on non-Windows systems. See Section 4.6.7, “mysql_config_editor — MySQL Configuration Utility”.%APPDATA%\MySQL\.mylogin.cnf
目录,在非Windows系统上为$HOME/.mylogin.cnf
。请参阅第4.6.7节,“mysql_config编辑器--mysql配置实用程序”。
The 如果MYSQL是在启用了测试协议跟踪客户端插件的情况下构建的,则MYSQL_TEST_TRACE_DEBUG
and MYSQL_TEST_TRACE_CRASH
variables control the test protocol trace client plugin, if MySQL is built with that plugin enabled. For more information, see Using the Test Protocol Trace Plugin.MYSQL_TEST_TRACE_DEBUG
和MYSQL_TEST_TRACE_CRASH
变量控制该插件。有关更多信息,请参阅使用测试协议跟踪插件。
The default 默认的UMASK
and UMASK_DIR
values are 0640
and 0750
, respectively. UMASK
和UMASK_DIR
值分别为0640
和0750
。MySQL assumes that the value for MySQL假设UMASK
or UMASK_DIR
is in octal if it starts with a zero. For example, setting UMASK=0600
is equivalent to UMASK=384
because 0600 octal is 384 decimal.UMASK
或UMASK_DIR
的值以零开头时为八进制。例如,设置UMASK=0600
等于UMASK=384
,因为0600
八进制是384
十进制。
The UMASK
and UMASK_DIR
variables, despite their names, are used as modes, not masks:UMASK
和UMASK_DIR
变量,尽管它们的名字是,但被用作模式,而不是掩码:
If 如果设置了UMASK
is set, mysqld uses ($UMASK | 0600)
as the mode for file creation, so that newly created files have a mode in the range from 0600 to 0666 (all values octal).UMASK
,mysqld将使用($UMASK|0600
)作为文件创建的模式,这样新创建的文件的模式范围为0600到0666(所有值均为八进制)。
If 如果设置了UMASK_DIR
is set, mysqld uses ($UMASK_DIR | 0700)
as the base mode for directory creation, which then is AND-ed with ~(~$UMASK & 0666)
, so that newly created directories have a mode in the range from 0700 to 0777 (all values octal). UMASK_DIR
,mysqld将使用($UMASK_DIR | 0700)
作为目录创建的基本模式,然后用~(~$UMASK & 0666)
进行AND运算,这样新创建的目录的模式范围为0700
到0777
(所有值均为八进制)。The AND operation may remove read and write permissions from the directory mode, but not execute permissions.AND操作可以从目录模式中删除读写权限,但不能删除执行权限。
See also Section B.3.3.1, “Problems with File Permissions”.另请参见第B.3.3.1节,“文件权限问题”。
It may be necessary to set 如果您使用pkg-config构建MySQL程序,可能需要设置PKG_CONFIG_PATH
if you use pkg-config for building MySQL programs. See Building C API Client Programs Using pkg-config.PKG_CONFIG_PATH
。请参阅使用pkg-config构建C API客户端程序。