Documentation Home
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 43.3Mb
PDF (A4) - 43.4Mb
Man Pages (TGZ) - 297.2Kb
Man Pages (Zip) - 402.4Kb
Info (Gzip) - 4.3Mb
Info (Zip) - 4.3Mb
Excerpts from this Manual

MySQL 8.0 Reference Manual  / MySQL Programs  /  Environment Variables

6.9 Environment Variables

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.

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. SeeSection 6.2.2.2, “Using Option Files”.

VariableDescription
AUTHENTICATION_KERBEROS_CLIENT_LOGKerberos authentication logging level.
AUTHENTICATION_LDAP_CLIENT_LOGClient-side LDAP authentication logging level.
AUTHENTICATION_PAM_LOGPAM authentication plugin debug logging settings.
CCThe name of your C compiler (for runningCMake).
CXXThe name of your C++ compiler (for runningCMake).
CCThe name of your C compiler (for runningCMake).
DBI_USERThe default user name for Perl DBI.
DBI_TRACETrace options for Perl DBI.
HOMEThe default path for themysql history file is$HOME/.mysql_history.
LD_RUN_PATHUsed to specify the location oflibmysqlclient.so.
LIBMYSQL_ENABLE_CLEARTEXT_PLUGINEnablemysql_clear_password authentication plugin; seeSection 8.4.1.4, “Client-Side Cleartext Pluggable Authentication”.
LIBMYSQL_PLUGIN_DIRDirectory in which to look for client plugins.
LIBMYSQL_PLUGINSClient plugins to preload.
MYSQL_DEBUGDebug trace options when debugging.
MYSQL_GROUP_SUFFIXOption group suffix value (like specifying--defaults-group-suffix).
MYSQL_HISTFILEThe path to themysql history file. If this variable is set, its value overrides the default for$HOME/.mysql_history.
MYSQL_HISTIGNOREPatterns specifying statements thatmysql should not log to$HOME/.mysql_history, orsyslog if--syslog is given.
MYSQL_HOMEThe path to the directory in which the server-specificmy.cnf file resides.
MYSQL_HOSTThe default host name used by themysql command-line client.
MYSQL_OPENSSL_UDF_DH_BITS_THRESHOLDMaximum key length forcreate_dh_parameters(). SeeSection 8.6.3, “MySQL Enterprise Encryption Usage and Examples”.
MYSQL_OPENSSL_UDF_DSA_BITS_THRESHOLDMaximum DSA key length forcreate_asymmetric_priv_key(). SeeSection 8.6.3, “MySQL Enterprise Encryption Usage and Examples”.
MYSQL_OPENSSL_UDF_RSA_BITS_THRESHOLDMaximum RSA key length forcreate_asymmetric_priv_key(). SeeSection 8.6.3, “MySQL Enterprise Encryption Usage and Examples”.
MYSQL_PS1The command prompt to use in themysql command-line client.
MYSQL_PWDThe default password when connecting tomysqld. Using this is insecure. See note following table.
MYSQL_TCP_PORTThe default TCP/IP port number.
MYSQL_TEST_LOGIN_FILEThe name of the.mylogin.cnf login path file.
MYSQL_TEST_TRACE_CRASHWhether the test protocol trace plugin crashes clients. See note following table.
MYSQL_TEST_TRACE_DEBUGWhether the test protocol trace plugin produces output. See note following table.
MYSQL_UNIX_PORTThe default Unix socket file name; used for connections tolocalhost.
MYSQLX_TCP_PORTThe X Plugin default TCP/IP port number.
MYSQLX_UNIX_PORTThe X Plugin default Unix socket file name; used for connections tolocalhost.
NOTIFY_SOCKETSocket used bymysqld to communicate with systemd.
PATHUsed by the shell to find MySQL programs.
PKG_CONFIG_PATHLocation ofmysqlclient.pcpkg-config file. See note following table.
TMPDIRThe directory in which temporary files are created.
TZThis should be set to your local time zone. SeeSection B.3.3.7, “Time Zone Problems”.
UMASKThe user-file creation mode when creating files. See note following table.
UMASK_DIRThe user-directory creation mode when creating directories. See note following table.
USERThe default user name on Windows when connecting tomysqld.

For information about themysql history file, seeSection 6.5.1.3, “mysql Client Logging”.

Use ofMYSQL_PWD to specify a MySQL password must be consideredextremely insecure and should not be used. Some versions ofps include an option to display the environment of running processes. On some systems, if you setMYSQL_PWD, your password is exposed to any other user who runsps. Even on systems without such a version ofps, it is unwise to assume that there are no other methods by which users can examine process environments.

MYSQL_PWD is deprecated as of MySQL 8.0; expect it to be removed in a future version of MySQL.

MYSQL_TEST_LOGIN_FILE is the path name of the login path file (the file created bymysql_config_editor). If not set, the default value is%APPDATA%\MySQL\.mylogin.cnf directory on Windows and$HOME/.mylogin.cnf on non-Windows systems. SeeSection 6.6.7, “mysql_config_editor — MySQL Configuration Utility”.

TheMYSQL_TEST_TRACE_DEBUG andMYSQL_TEST_TRACE_CRASH variables control the test protocol trace client plugin, if MySQL is built with that plugin enabled. For more information, seeUsing the Test Protocol Trace Plugin.

The defaultUMASK andUMASK_DIR values are0640 and0750, respectively. MySQL assumes that the value forUMASK orUMASK_DIR is in octal if it starts with a zero. For example, settingUMASK=0600 is equivalent toUMASK=384 because 0600 octal is 384 decimal.

TheUMASK andUMASK_DIR variables, despite their names, are used as modes, not masks:

  • IfUMASK 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).

  • IfUMASK_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). The AND operation may remove read and write permissions from the directory mode, but not execute permissions.

See alsoSection B.3.3.1, “Problems with File Permissions”.

It may be necessary to setPKG_CONFIG_PATH if you usepkg-config for building MySQL programs. SeeBuilding C API Client Programs Using pkg-config.