4.5.1.1 mysql Options

mysql supports the following options, which
can be specified on the command line or in the
[mysql] and [client]
groups of an option file. For information about option files
used by MySQL programs, see Section 4.2.6, “Using Option Files”.

Enable automatic rehashing. This option is on by default,
which enables database, table, and column name completion.
Use
--disable-auto-rehash
to disable rehashing. That causes mysql
to start faster, but you must issue the
rehash command if you want to use name
completion.

To complete a name, enter the first part and press Tab. If
the name is unambiguous, mysql completes
it. Otherwise, you can press Tab again to see the possible
names that begin with what you have typed so far. Completion
does not occur if there is no default database.

Use charset_name as the default
character set for the client and connection.

A common issue that can occur when the operating system uses
utf8 or another multibyte character set
is that output from the mysql client is
formatted incorrectly, due to the fact that the MySQL client
uses the latin1 character set by default.
You can usually fix such issues by using this option to
force the client to use the system character set instead.

Read this option file after the global option file but (on
Unix) before the user option file. As of MySQL 5.0.6, if the
file does not exist or is otherwise inaccessible, an error
occurs. file_name is the full
path name to the file.

Read not only the usual option groups, but also groups with
the usual names and a suffix of
str. For example,
mysql normally reads the
[client] and [mysql]
groups. If the
--defaults-group-suffix=_other
option is given, mysql also reads the
[client_other] and
[mysql_other] groups. This option was
added in MySQL 5.0.10.

Disable named commands. Use the \* form
only, or use named commands only at the beginning of a line
ending with a semicolon
(“;”).
mysql starts with this option
enabled by default. However, even with
this option, long-format commands still work from the first
line. See Section 4.5.1.2, “mysql Commands”.

Enable or disable LOCAL capability for
LOAD DATA
INFILE. With no value, the option enables
LOCAL. The option may be given as
--local-infile=0 or
--local-infile=1 to explicitly
disable or enable LOCAL. Enabling
LOCAL has no effect if the server does
not also support it.

Ignore statements except those that occur while the default
database is the one named on the command line. This option
is rudimentary and should be used with care. Statement
filtering is based only on
USE statements.

Initially, mysql executes statements in
the input because specifying a database
db_name on the command line is
equivalent to inserting
USE
db_name at the
beginning of the input. Then, for each
USE statement encountered,
mysql accepts or rejects following
statements depending on whether the database named is the
one on the command line. The content of the statements is
immaterial.

Use the given command for paging query output. If the
command is omitted, the default pager is the value of your
PAGER environment variable. Valid pagers
are less, more,
cat [> filename], and so forth. This
option works only on Unix and only in interactive mode. To
disable paging, use
--skip-pager.
Section 4.5.1.2, “mysql Commands”, discusses output paging
further.

The password to use when connecting to the server. If you
use the short option form (-p), you
cannot have a space between the option
and the password. If you omit the
password value following the
--password or
-p option on the command line,
mysql prompts for one.

The connection protocol to use for connecting to the server.
It is useful when the other connection parameters normally
would cause a protocol to be used other than the one you
want. For details on the permissible values, see
Section 4.2.2, “Connecting to the MySQL Server”.

For tabular output, the “boxing” around columns
enables one column value to be distinguished from another.
For nontabular output (such as is produced in batch mode or
when the --batch or
--silent option is given),
special characters are escaped in the output so they can be
identified easily. Newline, tab, NUL, and
backslash are written as \n,
\t, \0, and
\\. The
--raw option disables this
character escaping.

The following example demonstrates tabular versus nontabular
output and the use of raw mode to disable escaping:

Permit only those UPDATE and
DELETE statements that
specify which rows to modify by using key values. If you
have set this option in an option file, you can override it
by using --safe-updates on the
command line. See Section 4.5.1.6, “mysql Tips”, for more
information about this option.

Verbose mode. Produce more output about what the program
does. This option can be given multiple times to produce
more and more output. (For example, -v -v
-v produces table output format even in batch
mode.)

Prior to MySQL 5.0.26, there was no differentiation in the
output when using this option between columns containing
the NULL value and columns containing
the string literal 'NULL'; both were
represented as