content_image/786649.jpg
## Table 4.2 Option Files Read on Unix and Unix-Like Systems 

<img src='content_image/786649.jpg'>

In the preceding table, ~  represents the current user’s home directory (the value of $HOME ). 

SYSCONFDIR  represents the directory specified with the SYSCONFDIR  option to CMake  when MySQL was built. By default, this is the etc  directory located under the compiled-in installation directory. 

MYSQL_HOME  is an environment variable containing the path to the directory in which the server-specific my.cnf  file resides. If MYSQL_HOME  is not set and you start the server using the mysqld_safe  program, mysqld_safe  sets it to BASEDIR , the MySQL base installation directory. 

DATADIR  represents the MySQL data directory. As used to find mysqld-auto.cnf , its default value is the data directory location built in when MySQL was compiled, but can be changed by --datadir specified as an option-file or command-line option processed before mysqld-auto.cnf  is processed. 

If multiple instances of a given option are found, the last instance takes precedence, with one exception: For mysqld , the first  instance of the --user  option is used as a security precaution, to prevent a user specified in an option file from being overridden on the command line. 

## Option File Syntax 

The following description of option file syntax applies to files that you edit manually. This excludes .mylogin.cnf , which is created using mysql_config_editor  and is encrypted, and mysqld- auto.cnf , which the server creates in JSON format. 

Any long option that may be given on the command line when running a MySQL program can be given in an option file as well. To get the list of available options for a program, run it with the --help  option. (For mysqld , use --verbose  and --help .) 

The syntax for specifying options in an option file is similar to command-line syntax (see Section 4.2.2.1, “Using Options on the Command Line” ). However, in an option file, you omit the leading two dashes from the option name and you specify only one option per line. For example, --quick  and -- host=localhost  on the command line should be specified as quick  and host=localhost  on separate lines in an option file. To specify an option of the form --loose- opt_name  in an option file, write it as loose- opt_name . 

Empty lines in option files are ignored. Nonempty lines can take any of the following forms: 

• # comment , ; comment 

Comment lines start with #  or ; . A #  comment can start in the middle of a line as well. 

