Appendix H. Environment Variables

Here is a list of 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 configuration files and environment variables, and values in configuration files take precedence over values in environment variables.

In many cases it's preferable to use a configure file instead of environment variables to modify the behavior of MySQL. See Option files.

VariableDescription
CXXSet this to your C++ compiler when running configure.
CCSet this to your C compiler when running configure.
CFLAGSFlags for your C compiler when running configure.
CXXFLAGSFlags for your C++ compiler when running configure.
DBI_USERThe default username for Perl DBI.
DBI_TRACEUsed when tracing Perl DBI.
HOMEThe default path for the mysql history file is $HOME/.mysql_history.
LD_RUN_PATHUsed to specify where your libmysqlclient.so is.
MYSQL_DEBUGDebug-trace options when debugging.
MYSQL_HISTFILEThe path to the mysql history file.
MYSQL_HOSTDefault hostname used by the mysql command-line client.
MYSQL_PS1Command prompt to use in the mysql command-line client. See mysql, The Command-line Tool.
MYSQL_PWDThe default password when connecting to mysqld. Note that use of this is insecure!
MYSQL_TCP_PORTThe default TCP/IP port.
MYSQL_UNIX_PORTThe default socket; used for connections to localhost.
PATHUsed by the shell to finds the MySQL programs.
TMPDIRThe directory where temporary tables/files are created.
TZThis should be set to your local time zone. See Timezone problems.
UMASK_DIRThe user-directory creation mask when creating directories. Note that this is ANDed with UMASK!
UMASKThe user-file creation mask when creating files.
USERThe default user on Windows to use when connecting to mysqld.