Chapter 12 MySQL Program 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. See
Using Option Files.

The default UMASK and
UMASK_DIR values are 0660 and
0700, respectively. MySQL assumes that the value
for 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.

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.