Documentation Home
MySQL 5.5 Reference Manual
Related Documentation Download this Manual Excerpts from this Manual

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.

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

CXXThe name of your C++ compiler (for running CMake).
CCThe name of your C compiler (for running CMake).
DBI_USERThe default user name for Perl DBI.
DBI_TRACETrace options for Perl DBI.
HOMEThe default path for the mysql history file is $HOME/.mysql_history.
LD_RUN_PATHUsed to specify the location of
LIBMYSQL_ENABLE_CLEARTEXT_PLUGINEnable mysql_clear_password authentication plugin; see Section, “The Cleartext Client-Side Authentication Plugin”.
MYSQL_DEBUGDebug trace options when debugging.
MYSQL_GROUP_SUFFIXOption group suffix value (like specifying --defaults-group-suffix).
MYSQL_HISTFILEThe path to the mysql history file. If this variable is set, its value overrides the default for $HOME/.mysql_history.
MYSQL_HOMEThe path to the directory in which the server-specific my.cnf file resides.
MYSQL_HOSTThe default host name used by the mysql command-line client.
MYSQL_PS1The command prompt to use in the mysql command-line client.
MYSQL_PWDThe default password when connecting to mysqld. Note that using this is insecure. See Section, “End-User Guidelines for Password Security”.
MYSQL_TCP_PORTThe default TCP/IP port number.
MYSQL_UNIX_PORTThe default Unix socket file name; used for connections to localhost.
PATHUsed by the shell to find MySQL programs.
TMPDIRThe directory where temporary files are created.
TZThis should be set to your local time zone. See Section B.5.4.6, “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 to mysqld.

For information about the mysql history file, see Section, “mysql Logging”.

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

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

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

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

Download this Manual
User Comments
  Posted by Alexander Janssen on July 30, 2006
Warning: Debian Backports is currently (as of 30th of July 2006) offering version 5.0.22-Debian_2bpo1-log which has a severe problem with handling the MYSQL_HISTFILE.

The manual-page says:

On Unix, the mysql client writes a record of executed statements to a
history file. By default, the history file is named .mysql_history and
is created in your home directory. To specify a different file, set the
value of the MYSQL_HISTFILE environment variable.

If you do not want to maintain a history file, first remove
.mysql_history if it exists, and then use either of the following

o Set the MYSQL_HISTFILE variable to /dev/null. To cause this setting
to take effect each time you log in, put the setting in one of your
shell's startup files.

o Create .mysql_history as a symbolic link to /dev/null:

shell> ln -s /dev/null $HOME/.mysql_history
You need do this only once.

Be warned. I really mean it. A damaged /dev/null brakes your server.


Sign Up Login You must be logged in to post a comment.