Database Reference
In-Depth Information
group and also picks up the
skip-auto-rehash
and
pager
options from the
[mysql]
group.
• Within a group, write option lines in
name=value
format, where
name
corresponds
to an option name (without leading dashes) and
value
is the option's value. If an
option takes no value (such as
skip-auto-rehash
), list the name by itself with no
trailing
=value
part.
• In option files, only the long form of an option is permitted, not the short form.
For example, on the command line, the hostname can be given using either
-h
host_name
or
--host=
host_name
. In an option file, only
host=
host_name
is per‐
mitted.
• Many programs,
mysql
and
mysqld
included, have program variables in addition
to command options. (For the server, these are called system variables; see
Recipe 22.1
.) Program variables can be specified in option files, just like options.
Internally, program variable names use underscores, but in option files, you can
write options and variables using dashes or underscores interchangeably. For ex‐
ample,
skip-auto-rehash
and
skip_auto_rehash
are equivalent. To set the server's
sql_mode
system variable in a
[mysqld]
option group,
sql_mode=
value
and
sql-
mode=
value
are equivalent. (Interchangeability of dash and underscore also applies
for options or variables specified on the command line.)
• In option files, spaces are permitted around the
=
that separates an option name
and value. This contrasts with command lines, where no spaces around
=
are per‐
mitted.
• If an option value contains spaces or other special characters, you can quote it using
single or double quotes. The
pager
option illustrates this.
• It's common to use an option file to specify options for connection parameters (such
as
host
,
user
, and
password
). However, the file can list options that have other
purposes. The
pager
option shown for the
[mysql]
group specifies the paging pro‐
gram that
mysql
should use for displaying output in interactive mode. It has nothing
to do with how the program connects to the server.
• If a parameter appears multiple times in an option file, the last value found takes
precedence. Normally, you should list any program-specific groups following the
[client]
group so that if there is any overlap in the options set by the two groups,
the more general options are overridden by the program-specific values.
• Lines beginning with
#
or
;
characters are ignored as comments. Blank lines are
ignored, too.
#
can be used to write comments at the end of option lines, as shown
for the
pager
option.
• Options that specify file or directory pathnames should be written using
/
as the
pathname separator character, even under Windows, which uses
\
as the pathname