2.12. Environment Variables

This section lists all the environment variables that are used directly or indirectly by MySQL. Most of these can also be found in other places in this manual.

Note that any 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.3.3, "Using Option Files".

Variable Description
CXX The name of your C++ compiler (for running CMake).
CC The name of your C compiler (for running CMake).
CFLAGS Flags for your C compiler (for running CMake).
CXXFLAGS Flags for your C++ compiler (for running CMake).
DBI_USER The default user name for Perl DBI.
DBI_TRACE Trace options for Perl DBI.
HOME The default path for the mysql history file is $HOME/.mysql_history.
LD_RUN_PATH Used to specify the location of libmysqlclient.so.
LIBMYSQL_ENABLE_CLEARTEXT_PLUGIN Enable mysql_clear_password authentication plugin; see Section 6.3.7.3, "The Cleartext Client-Side Authentication Plugin".
LIBMYSQL_PLUGIN_DIR Directory in which to look for client plugins.
LIBMYSQL_PLUGINS Client plugins to preload.
MYSQL_DEBUG Debug trace options when debugging.
MYSQL_GROUP_SUFFIX Option group suffix value (like specifying --defaults-group-suffix).
MYSQL_HISTFILE The path to the mysql history file. If this variable is set, its value overrides the default for $HOME/.mysql_history.
MYSQL_HISTIGNORE Patterns specifying statements that mysql should not log to $HOME/.mysql_history, or syslog if --syslog is given.
MYSQL_HOME The path to the directory in which the server-specific my.cnf file resides.
MYSQL_HOST The default host name used by the mysql command-line client.
MYSQL_PS1 The command prompt to use in the mysql command-line client.
MYSQL_PWD The default password when connecting to mysqld. Note that using this is insecure. See Section 6.1.2.1, "End-User Guidelines for Password Security".
MYSQL_TCP_PORT The default TCP/IP port number.
MYSQL_TEST_LOGIN_FILE The name of the .mylogin.cnf login file.
MYSQL_UNIX_PORT The default Unix socket file name; used for connections to localhost.
PATH Used by the shell to find MySQL programs.
TMPDIR The directory where temporary files are created.
TZ This should be set to your local time zone. See Section C.5.4.6, "Time Zone Problems".
UMASK The user-file creation mode when creating files. See note following table.
UMASK_DIR The user-directory creation mode when creating directories. See note following table.
USER The default user name on Windows when connecting tomysqld.

For information about the mysql history file, see Section 4.5.1.3, "mysql Logging".

MYSQL_TEST_LOGIN_FILE is the path name of the login file (the file created by mysql_config_editor). If not set, the default value is %APPDATA%\MySQL\.mylogin.cnf directory on Windows and $HOME/.mylogin.cnf on non-Windows systems. See Section 4.6.6, "mysql_config_editor — MySQL Configuration Utility".

The UMASK and UMASK_DIR variables, despite their names, are used as modes, not masks:

MySQL assumes that the value for UMASK or UMASK_DIR is in octal if it starts with a zero.




Spec-Zone.ru - all specs in one place