Specifying Program Options
237
Typically,
DATADIR
is
/usr/local/mysql/data
for a binary installation or
/usr/local/var
for
a source installation. Note that this is the data directory location that was specified at configuration
time, not the one specified with the
--datadir
[404]
option when
mysqld
starts. Use of
--
datadir
[404]
at runtime has no effect on where the server looks for option files, because it looks for
them before processing any options.
MySQL looks for option files in the order just described and reads any that exist. If an option file that
you want to use does not exist, create it with a plain text editor.
If multiple instances of a given option are found, the last instance takes precedence. There is one
exception: For
mysqld
, the first instance of the
--user
[424]
option is used as a security precaution,
to prevent a user specified in an option file from being overridden on the command line.
Note
On Unix platforms, MySQL ignores configuration files that are world-writable.
This is intentional as a security measure.
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.
The syntax for specifying options in an option file is similar to command-line syntax (see
Section 4.2.3.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.
•
[group]
group
is the name of the program or group for which you want to set options. After a group line, any
option-setting lines apply to the named group until the end of the option file or another group line is
given. Option group names are not case sensitive.
•
opt_name
This is equivalent to
--opt_name
on the command line.
•
opt_name=value
This is equivalent to
--opt_name=value
on the command line. In an option file, you can have
spaces around the “
=
” character, something that is not true on the command line. You can optionally
enclose the value within single quotation marks or double quotation marks, which is useful if the
value contains a “
#
” comment character.
Leading and trailing spaces are automatically deleted from option names and values.
You can use the escape sequences “
\b
”, “
\t
”, “
\n
”, “
\r
”, “
\\
”, and “
\s
” in option values to represent
the backspace, tab, newline, carriage return, backslash, and space characters. The escaping rules in
option files are:
• If a backslash is followed by a valid escape sequence character, the sequence is converted to the
character represented by the sequence. For example, “
\s
” is converted to a space.
• If a backslash is not followed by a valid escape sequence character, it remains unchanged. For
example, “
\S
” is retained as is.
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...