2009-09-16 14:03:18 +02:00
'\" t
2009-05-25 11:59:47 +02:00
. \"
2019-03-28 12:12:28 +01:00
.TH "\FBMYSQL\FR" "1" "28 March 2019" "MariaDB 10\&.4" "MariaDB Database System"
2009-09-16 14:03:18 +02:00
. \" -----------------------------------------------------------------
. \" * set default formatting
. \" -----------------------------------------------------------------
2009-05-25 11:59:47 +02:00
. \" disable hyphenation
.nh
. \" disable justification (adjust text to left margin only)
.ad l
2009-09-16 14:03:18 +02:00
. \" -----------------------------------------------------------------
. \" * MAIN CONTENT STARTS HERE *
. \" -----------------------------------------------------------------
. \" mysql
. \" command-line tool
. \" tools: command-line
. \" scripts: SQL
. \" SQL scripts
. \" batch SQL files
2009-05-25 11:59:47 +02:00
.SH "NAME"
2015-09-17 14:34:03 +02:00
mysql \- the MariaDB command\- line tool
2009-05-25 11:59:47 +02:00
.SH "SYNOPSIS"
2009-09-16 14:03:18 +02:00
.HP \w '\fBmysql\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR \fB \fI db_name\fR\fR\ 'u
2009-05-25 11:59:47 +02:00
\fB mysql [\fR \fB \fI options\fR \fR \fB ] \fR \fB \fI db_name\fR \fR
.SH "DESCRIPTION"
.PP
\fB mysql\fR
is a simple SQL shell (with GNU
readline
2015-09-17 14:34:03 +02:00
capabilities)\& . It supports interactive and non\- interactive use\& . When used interactively, query results are presented in an ASCII\- table format\& . When used non\- interactively (for example, as a filter), the result is presented in tab\- separated format\& . The output format can be changed using command options\& .
2009-05-25 11:59:47 +02:00
.PP
If you have problems due to insufficient memory for large result sets, use the
\fB \- \- quick\fR
2009-09-16 14:03:18 +02:00
option\& . This forces
2009-05-25 11:59:47 +02:00
\fB mysql\fR
2009-09-16 14:03:18 +02:00
to retrieve results from the server a row at a time rather than retrieving the entire result set and buffering it in memory before displaying it\& . This is done by returning the result set using the
2009-05-25 11:59:47 +02:00
mysql_use_result()
C API function in the client/server library rather than
2009-09-16 14:03:18 +02:00
mysql_store_result()\& .
2009-05-25 11:59:47 +02:00
.PP
Using
\fB mysql\fR
2009-09-16 14:03:18 +02:00
is very easy\& . Invoke it from the prompt of your command interpreter as follows:
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
shell> \fB mysql \fR \fB \fI db_name\fR \fR
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
Or:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
shell> \fB mysql \- \- user=\fR \fB \fI user_name\fR \fR \fB \- \- password=\fR \fB \fI your_password\fR \fR \fB \fR \fB \fI db_name\fR \fR
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
Then type an SQL statement, end it with
\(lq ;\(rq ,
2009-09-16 14:03:18 +02:00
\e g, or
\e G
and press Enter\& .
2009-05-25 11:59:47 +02:00
.PP
2015-09-17 14:34:03 +02:00
Typing Control\- C causes
2009-05-25 11:59:47 +02:00
\fB mysql\fR
2009-09-16 14:03:18 +02:00
to attempt to kill the current statement\& . If this cannot be done, or Control\- C is typed again before the statement is killed,
2009-05-25 11:59:47 +02:00
\fB mysql\fR
2015-09-17 14:34:03 +02:00
exits\& .
2009-05-25 11:59:47 +02:00
.PP
You can execute SQL statements in a script file (batch file) like this:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
shell> \fB mysql \fR \fB \fI db_name\fR \fR \fB < \fR \fB \fI script\& .sql\fR \fR \fB > \fR \fB \fI output\& .tab\fR \fR
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
.SH "MYSQL OPTIONS"
. \" mysql command options
. \" command options: mysql
. \" options: command-line: mysql
. \" startup parameters: mysql
2009-05-25 11:59:47 +02:00
.PP
\fB mysql\fR
2010-04-28 15:06:11 +02:00
supports the following options, which can be specified on the command line or in the
2015-09-17 14:34:03 +02:00
[mysql], [client], [client-server] or [client-mariadb]
2010-04-28 15:06:11 +02:00
option file groups\& .
\fB mysql\fR
2015-09-17 14:34:03 +02:00
also supports the options for processing option files\& .
2009-09-16 14:03:18 +02:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: help option
. \" help option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- help\fR ,
2013-06-13 00:13:23 +02:00
\fB \- ?\fR ,
\fB \- I\fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Display a help message and exit\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2015-09-17 14:34:03 +02:00
. \" mysql: abort-source-on-error option
. \" abort-source-on-error: mysql
\fB \- \- abort\- source\- on\- error\fR
.sp
Abort 'source filename' operations in case of errors\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-09-16 14:03:18 +02:00
. \" mysql: auto-rehash option
. \" auto-rehash option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- auto\- rehash\fR
.sp
2009-09-16 14:03:18 +02:00
Enable automatic rehashing\& . This option is on by default, which enables database, table, and column name completion\& . Use
2015-09-17 14:34:03 +02:00
\fB \- \- disable\- auto\- rehash\fR , \fB \- \- no\- auto\- rehash\fR , or \fB \- \- skip\- auto\- rehash\fR
2009-09-16 14:03:18 +02:00
to disable rehashing\& . That causes
2009-05-25 11:59:47 +02:00
\fB mysql\fR
to start faster, but you must issue the
rehash
2009-09-16 14:03:18 +02:00
command if you want to use name completion\& .
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
To complete a name, enter the first part and press Tab\& . If the name is unambiguous,
2009-05-25 11:59:47 +02:00
\fB mysql\fR
2009-09-16 14:03:18 +02:00
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\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2015-09-17 14:34:03 +02:00
. \" mysql: auto-vertical-output option
. \" auto-vertical-output option: mysql
\fB \- \- auto\- vertical\- output\fR
.sp
Automatically switch to vertical output mode if the result is wider than the terminal width\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-09-16 14:03:18 +02:00
. \" mysql: batch option
. \" batch option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- batch\fR ,
\fB \- B\fR
.sp
2009-09-16 14:03:18 +02:00
Print results using tab as the column separator, with each row on a new line\& . With this option,
2009-05-25 11:59:47 +02:00
\fB mysql\fR
2009-09-16 14:03:18 +02:00
does not use the history file\& .
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Batch mode results in nontabular output format and escaping of special characters\& . Escaping may be disabled by using raw mode; see the description for the
2009-05-25 11:59:47 +02:00
\fB \- \- raw\fR
2009-09-16 14:03:18 +02:00
option\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2015-09-17 14:34:03 +02:00
. \" mysql: binary-mode option
. \" binary-mode option: mysql
\fB \- \- binary\- mode\fR
.sp
2021-10-07 19:28:49 +02:00
Binary mode allows certain character sequences to be processed as data that
would otherwise be treated with a special meaning by the parser\& .
Specifically, this switch turns off parsing of all client commands except \e C
and DELIMITER in non-interactive mode (i\& .e\& ., when binary mode is combined
with either 1) piped input, 2) the --batch mysql option, or 3) the 'source'
command)\& . Also, in binary mode, occurrences of '\e r\e n' and ASCII '\e 0' are
preserved within strings, whereas by default, '\e r\e n' is translated to '\e n'
and '\e 0' is disallowed in user input\& .
2015-09-17 14:34:03 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-09-16 14:03:18 +02:00
. \" mysql: character-sets-dir option
. \" character-sets-dir option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- character\- sets\- dir=\fR \fB \fI path\fR \fR
.sp
2015-09-17 14:34:03 +02:00
The directory where character sets are installed\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: column-names option
. \" column-names option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- column\- names\fR
.sp
2009-09-16 14:03:18 +02:00
Write column names in results\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: column-type-info option
. \" column-type-info option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- column\- type\- info\fR ,
\fB \- m\fR
.sp
2015-09-17 14:34:03 +02:00
Display result set metadata\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: comments option
. \" comments option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- comments\fR ,
\fB \- c\fR
.sp
2015-09-17 14:34:03 +02:00
Whether to preserve comments in statements sent to the server\& . The default is \- \- skip\- comments (discard comments), enable with \- \- comments (preserve comments)\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: compress option
. \" compress option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- compress\fR ,
\fB \- C\fR
.sp
2009-09-16 14:03:18 +02:00
Compress all information sent between the client and the server if both support compression\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2013-06-13 00:13:23 +02:00
. \" mysql: connect-timeout option
. \" connect-timeout option: mysql
\fB \- \- connect\- timeout=\fR \fB \fI seconds\fR \fR
.sp
Set the number of seconds before connection timeout\& . (Default value is 0\& .)
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-09-16 14:03:18 +02:00
. \" mysql: database option
. \" database option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- database=\fR \fB \fI db_name\fR \fR ,
\fB \- D \fR \fB \fI db_name\fR \fR
.sp
2015-09-17 14:34:03 +02:00
The database to use\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: debug option
. \" debug option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- debug[=\fR \fB \fI debug_options\fR \fR \fB ]\fR ,
\fB \- # [\fR \fB \fI debug_options\fR \fR \fB ]\fR
.sp
2009-09-16 14:03:18 +02:00
Write a debugging log\& . A typical
2009-05-25 11:59:47 +02:00
\fI debug_options\fR
2009-09-16 14:03:18 +02:00
string is
\' d:t:o,\fI file_name\fR \' \& . The default is
\' d:t:o,/tmp/mysql\& .trace\' \& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: debug-check option
. \" debug-check option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- debug\- check\fR
.sp
2015-09-17 14:34:03 +02:00
Print some debugging information when the program exits\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: debug-info option
. \" debug-info option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- debug\- info\fR ,
\fB \- T\fR
.sp
2015-09-17 14:34:03 +02:00
Prints debugging information and memory and CPU usage statistics when the program exits\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: default-auth option
. \" default-auth option: mysql
\fB \- \- default\- auth=\fR \fB \fI name\fR
.sp
Default authentication client-side plugin to use\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: default-character-set option
. \" default-character-set option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- default\- character\- set=\fR \fB \fI charset_name\fR \fR
.sp
Use
\fI charset_name\fR
2009-12-01 08:24:05 +01:00
as the default character set for the client and connection\& .
.sp
A common issue that can occur when the operating system uses
utf8
or another multi\- byte character set is that output from the
\fB mysql\fR
2015-09-17 14:34:03 +02:00
client is formatted incorrectly, due to the fact that the MariaDB client uses the
2009-12-01 08:24:05 +01:00
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\& .
2015-09-17 14:34:03 +02:00
.RE
2009-12-01 08:24:05 +01:00
.sp
2015-09-17 14:34:03 +02:00
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: defaults-extra-file option
. \" defaults-extra-file option: mysql
\fB \- \- defaults-extra-file=\fR \fB \fI filename\fR \fR
.sp
Set \fB \fI filename\fR \fR as the file to read default options from after the global defaults files has been read\& .
Must be given as first option\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2013-06-13 00:13:23 +02:00
. \" mysql: defaults-file option
. \" defaults-file option: mysql
\fB \- \- defaults-file=\fR \fB \fI filename\fR \fR
.sp
Set \fB \fI filename\fR \fR as the file to read default options from, override global defaults files\& . Must be given as first option\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2015-09-17 14:34:03 +02:00
. \" mysql: defaults-group-suffix option
. \" defaults-group-suffix option: mysql
\fB \- \- defaults\- group\- suffix=\fR \fB \fI suffix\fR \fR
2013-06-13 00:13:23 +02:00
.sp
2015-09-17 14:34:03 +02:00
In addition to the groups named on the command line, read groups that have the given suffix\& .
2013-06-13 00:13:23 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-09-16 14:03:18 +02:00
. \" mysql: delimiter option
. \" delimiter option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- delimiter=\fR \fB \fI str\fR \fR
.sp
2009-09-16 14:03:18 +02:00
Set the statement delimiter\& . The default is the semicolon character (\(lq ;\(rq )\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: disable named commands
. \" disable named command: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- disable\- named\- commands\fR
.sp
2009-09-16 14:03:18 +02:00
Disable named commands\& . Use the
\e *
form only, or use named commands only at the beginning of a line ending with a semicolon (\(lq ;\(rq )\& .
2009-05-25 11:59:47 +02:00
\fB mysql\fR
starts with this option
\fI enabled\fR
2009-09-16 14:03:18 +02:00
by default\& . However, even with this option, long\- format commands still work from the first line\& . See
the section called \(lq MYSQL COMMANDS\(rq \& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2022-05-03 19:25:48 +02:00
. \" mysql: enable cleartext plugin option
. \" enable cleartext plugin option: mysql
\fB \- \- enable\- cleartext\- plugin\fR
.sp
Obsolete option\& . Exists only for MySQL compatibility\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-09-16 14:03:18 +02:00
. \" mysql: execute option
. \" execute option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- execute=\fR \fB \fI statement\fR \fR ,
\fB \- e \fR \fB \fI statement\fR \fR
.sp
2015-09-17 14:34:03 +02:00
Execute the statement and quit\& . Disables \fB \- \- force\fR and history file\& . The default output format is like that produced with
\fB \- \- batch\fR \& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: force option
. \" force option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- force\fR ,
\fB \- f\fR
.sp
2015-09-17 14:34:03 +02:00
Continue even if an SQL error occurs\& . Sets \fB \- \- abort\- source\- on-error\fR to 0\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: host option
. \" host option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- host=\fR \fB \fI host_name\fR \fR ,
\fB \- h \fR \fB \fI host_name\fR \fR
.sp
2015-09-17 14:34:03 +02:00
Connect to the MariaDB server on the given host\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: html option
. \" html option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- html\fR ,
\fB \- H\fR
.sp
2009-09-16 14:03:18 +02:00
Produce HTML output\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: ignore-spaces option
. \" ignore-spaces option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- ignore\- spaces\fR ,
\fB \- i\fR
.sp
2015-09-17 14:34:03 +02:00
Ignore spaces after function names\& . Allows one to have spaces (including tab characters and new line characters) between function name and '('\& . The drawback is that this causes built in functions to become reserved words\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: init-command option
. \" init-command option: mysql
\fB \- \- init\- command=\fR \fB \fI str\fR \fR \fR
.sp
SQL Command to execute when connecting to the MariaDB server\& . Will automatically be re-executed when reconnecting\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: line-numbers option
. \" line-numbers option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- line\- numbers\fR
.sp
2009-09-16 14:03:18 +02:00
Write line numbers for errors\& . Disable this with
\fB \- \- skip\- line\- numbers\fR \& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: local-infile option
. \" local-infile option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- local\- infile[={0|1}]\fR
.sp
Enable or disable
LOCAL
capability for
2009-09-16 14:03:18 +02:00
LOAD DATA INFILE\& . With no value, the option enables
LOCAL\& . The option may be given as
2009-05-25 11:59:47 +02:00
\fB \- \- local\- infile=0\fR
or
\fB \- \- local\- infile=1\fR
to explicitly disable or enable
2009-09-16 14:03:18 +02:00
LOCAL\& . Enabling
2009-05-25 11:59:47 +02:00
LOCAL
2009-09-16 14:03:18 +02:00
has no effect if the server does not also support it\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2013-06-13 00:13:23 +02:00
. \" mysql: max-allowed-packet option
. \" max-allowed-packet option: mysql
\fB \- \- max\- allowed\- packet=\fR \fB \fI num\fR \fR
.sp
2015-09-17 14:34:03 +02:00
Set the maximum packet length to send to or receive from the server\& . (Default value is 16MB, largest 1GB\& .)
2013-06-13 00:13:23 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: max-join-size option
. \" max-join-size option: mysql
\fB \- \- max\- join\- size=\fR \fB \fI num\fR \fR
.sp
Set the automatic limit for rows in a join when using
\fB \- \- safe\- updates\fR \& . (Default value is 1,000,000\& .)
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-09-16 14:03:18 +02:00
. \" mysql: named-commands option
. \" named-commands option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- named\- commands\fR ,
\fB \- G\fR
.sp
Enable named
\fB mysql\fR
2009-09-16 14:03:18 +02:00
commands\& . Long\- format commands are allowed, not just short\- format commands\& . For example,
2009-05-25 11:59:47 +02:00
quit
and
2009-09-16 14:03:18 +02:00
\e q
both are recognized\& . Use
2009-05-25 11:59:47 +02:00
\fB \- \- skip\- named\- commands\fR
2009-09-16 14:03:18 +02:00
to disable named commands\& . See
2015-09-17 14:34:03 +02:00
the section called \(lq MYSQL COMMANDS\(rq \& . Disabled by default\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2013-06-13 00:13:23 +02:00
\h '-04'\(bu \h '+03'\c
. \}
. \" mysql: net-buffer-length option
. \" net-buffer-length option: mysql
2017-11-15 05:37:32 +01:00
\fB \- \- net\- buffer\- length=\fR \fB \fI size\fR \fR
2013-06-13 00:13:23 +02:00
.sp
Set the buffer size for TCP/IP and socket communication\& . (Default value is 16KB\& .)
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-09-16 14:03:18 +02:00
. \" mysql: no-auto-rehash option
. \" no-auto-rehash option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- no\- auto\- rehash\fR ,
\fB \- A\fR
.sp
2010-04-28 15:06:11 +02:00
This has the same effect as
2013-06-13 00:13:23 +02:00
\fB \- \- skip\- auto\- rehash\fR \& . See the description for
2009-09-16 14:03:18 +02:00
\fB \- \- auto\- rehash\fR \& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: no-beep option
. \" no-beep option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- no\- beep\fR ,
\fB \- b\fR
.sp
2009-09-16 14:03:18 +02:00
Do not beep when errors occur\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2013-06-13 00:13:23 +02:00
. \" mysql: no-defaults option
. \" no-defaults option: mysql
\fB \- \- no\- defaults\fR
.sp
Do not read default options from any option file\& . This must be given as the first argument\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-09-16 14:03:18 +02:00
. \" mysql: one-database option
. \" one-database option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- one\- database\fR ,
\fB \- o\fR
.sp
2015-09-17 14:34:03 +02:00
Ignore statements except those those that occur while the default database is the one named on the command line\& . This filtering is limited, and based only on USE statements\& . This is useful for skipping updates to other databases in the binary log\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: pager option
. \" pager option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- pager[=\fR \fB \fI command\fR \fR \fB ]\fR
.sp
2009-09-16 14:03:18 +02:00
Use the given command for paging query output\& . If the command is omitted, the default pager is the value of your
2009-05-25 11:59:47 +02:00
PAGER
2009-09-16 14:03:18 +02:00
environment variable\& . Valid pagers are
2009-05-25 11:59:47 +02:00
\fB less\fR ,
\fB more\fR ,
2009-12-01 08:24:05 +01:00
\fB cat [> filename]\fR , and so forth\& . This option works only on Unix and only in interactive mode\& . To disable paging, use
2009-09-16 14:03:18 +02:00
\fB \- \- skip\- pager\fR \& .
the section called \(lq MYSQL COMMANDS\(rq , discusses output paging further\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: password option
. \" password option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- password[=\fR \fB \fI password\fR \fR \fB ]\fR ,
\fB \- p[\fR \fB \fI password\fR \fR \fB ]\fR
.sp
2009-09-16 14:03:18 +02:00
The password to use when connecting to the server\& . If you use the short option form (\fB \- p\fR ), you
2009-05-25 11:59:47 +02:00
\fI cannot\fR
2009-09-16 14:03:18 +02:00
have a space between the option and the password\& . If you omit the
2009-05-25 11:59:47 +02:00
\fI password\fR
value following the
\fB \- \- password\fR
or
\fB \- p\fR
2010-04-28 15:06:11 +02:00
option on the command line,
\fB mysql\fR
prompts for one\& .
2009-09-16 14:03:18 +02:00
.sp
2015-09-17 14:34:03 +02:00
Specifying a password on the command line should be considered insecure\& . You can use an option file to avoid giving the password on the command line\& .
2009-09-16 14:03:18 +02:00
.RE
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: pipe option
. \" pipe option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- pipe\fR ,
\fB \- W\fR
.sp
2010-04-28 15:06:11 +02:00
On Windows, connect to the server via a named pipe\& . This option applies only if the server supports named\- pipe connections\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2015-09-17 14:34:03 +02:00
. \" mysql: plugin-dir option
. \" plugin-dir option: mysql
\fB \- \- plugin\- dir=\fI dir_name\fR
.sp
Directory for client-side plugins\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-09-16 14:03:18 +02:00
. \" mysql: port option
. \" port option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- port=\fR \fB \fI port_num\fR \fR ,
\fB \- P \fR \fB \fI port_num\fR \fR
.sp
2015-09-17 14:34:03 +02:00
The TCP/IP port number to use for the connection or 0 for default to, in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306)\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2013-06-13 00:13:23 +02:00
. \" mysql: print-defaults option
. \" print-defaults option: mysql
\fB \- \- print\- defaults\fR
.sp
Print the program argument list and exit\& . This must be given as the first argument\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2015-09-17 14:34:03 +02:00
. \" mysql: progress-reports option
. \" progress-reports option: mysql
\fB \- \- progress\- reports\fR
.sp
Get progress reports for long running commands (such as ALTER TABLE)\& . (Defaults to on; use \fB \- \- skip\- progress\- reports\fR to disable\& .)
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-09-16 14:03:18 +02:00
. \" mysql: prompt option
. \" prompt option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- prompt=\fR \fB \fI format_str\fR \fR
.sp
2015-09-17 14:34:03 +02:00
Set the prompt to the specified format\& . The special sequences that the prompt can contain are described in
2009-09-16 14:03:18 +02:00
the section called \(lq MYSQL COMMANDS\(rq \& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: protocol option
. \" protocol option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- protocol={TCP|SOCKET|PIPE|MEMORY}\fR
.sp
2015-09-17 14:34:03 +02:00
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\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: quick option
. \" quick option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- quick\fR ,
\fB \- q\fR
.sp
2009-09-16 14:03:18 +02:00
Do not cache each query result, print each row as it is received\& . This may slow down the server if the output is suspended\& . With this option,
2009-05-25 11:59:47 +02:00
\fB mysql\fR
2009-09-16 14:03:18 +02:00
does not use the history file\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: raw option
. \" raw option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- raw\fR ,
\fB \- r\fR
.sp
For tabular output, the
\(lq boxing\(rq
2009-09-16 14:03:18 +02:00
around columns enables one column value to be distinguished from another\& . For nontabular output (such as is produced in batch mode or when the
2009-05-25 11:59:47 +02:00
\fB \- \- batch\fR
or
\fB \- \- silent\fR
2009-09-16 14:03:18 +02:00
option is given), special characters are escaped in the output so they can be identified easily\& . Newline, tab,
2009-05-25 11:59:47 +02:00
NUL, and backslash are written as
2009-09-16 14:03:18 +02:00
\e n,
\e t,
\e 0, and
\e \e \& . The
2009-05-25 11:59:47 +02:00
\fB \- \- raw\fR
2009-09-16 14:03:18 +02:00
option disables this character escaping\& .
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
The following example demonstrates tabular versus nontabular output and the use of raw mode to disable escaping:
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
% \fB mysql\fR
mysql> SELECT CHAR(92);
+\- \- \- \- \- \- \- \- \- \- +
| CHAR(92) |
+\- \- \- \- \- \- \- \- \- \- +
2009-09-16 14:03:18 +02:00
| \e |
2009-05-25 11:59:47 +02:00
+\- \- \- \- \- \- \- \- \- \- +
% \fB mysql \- s\fR
mysql> SELECT CHAR(92);
CHAR(92)
2009-09-16 14:03:18 +02:00
\e \e
2009-05-25 11:59:47 +02:00
% \fB mysql \- s \- r\fR
mysql> SELECT CHAR(92);
CHAR(92)
2009-09-16 14:03:18 +02:00
\e
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
.RE
. \}
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: reconnect option
. \" reconnect option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- reconnect\fR
.sp
2015-09-17 14:34:03 +02:00
If the connection to the server is lost, automatically try to reconnect\& . A single reconnect attempt is made each time the connection is lost\& . Enabled by default, to disable use
\fB \- \- skip\- reconnect\fR or \fB \- \- disable\- reconnect\fR \& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: safe-updates option
. \" safe-updates option: mysql
. \" mysql: i-am-a-dummy option
. \" i-am-a-dummy option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- safe\- updates\fR ,
\fB \- \- i\- am\- a\- dummy\fR ,
\fB \- U\fR
.sp
Allow only those
UPDATE
and
DELETE
2009-09-16 14:03:18 +02:00
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
2009-05-25 11:59:47 +02:00
\fB \- \- safe\- updates\fR
2009-09-16 14:03:18 +02:00
on the command line\& . See
the section called \(lq MYSQL TIPS\(rq , for more information about this option\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: secure-auth option
. \" secure-auth option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- secure\- auth\fR
.sp
2009-09-16 14:03:18 +02:00
Do not send passwords to the server in old (pre\- 4\& .1\& .1) format\& . This prevents connections except for servers that use the newer password format\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2013-06-13 00:13:23 +02:00
. \" mysql: select-limit option
. \" select-limit option: mysql
\fB \- \- select\- limit=\fR \fB \fI limit\fR \fR
.sp
Set automatic limit for SELECT when using \fB \- \- safe\- updates\fR \& . (Default value is 1,000\& .)
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: server-arg option
. \" server-arg option: mysql
\fB \- \- server\- arg=\fR \fB \fI name\fR \fR
.sp
Send \fB \fI name\fR \fR as a parameter to the embedded server\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-09-16 14:03:18 +02:00
. \" mysql: show-warnings option
. \" show-warnings option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- show\- warnings\fR
.sp
2009-09-16 14:03:18 +02:00
Cause warnings to be shown after each statement if there are any\& . This option applies to interactive and batch mode\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: sigint-ignore option
. \" sigint-ignore option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- sigint\- ignore\fR
.sp
Ignore
SIGINT
2009-09-16 14:03:18 +02:00
signals (typically the result of typing Control\- C)\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: silent option
. \" silent option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- silent\fR ,
\fB \- s\fR
.sp
2009-09-16 14:03:18 +02:00
Silent mode\& . Produce less output\& . This option can be given multiple times to produce less and less output\& .
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
This option results in nontabular output format and escaping of special characters\& . Escaping may be disabled by using raw mode; see the description for the
2009-05-25 11:59:47 +02:00
\fB \- \- raw\fR
2009-09-16 14:03:18 +02:00
option\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2013-06-13 00:13:23 +02:00
. \" mysql: skip-auto-rehash option
. \" skip-auto-rehash option: mysql
\fB \- \- skip\- auto\- rehash\fR
.sp
Disable automatic rehashing\& . Synonym for \fB \- \- disable\- auto\- rehash\fR \& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-09-16 14:03:18 +02:00
. \" mysql: skip-column-names option
. \" skip-column-names option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- skip\- column\- names\fR ,
\fB \- N\fR
.sp
2010-04-28 15:06:11 +02:00
Do not write column names in results\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: skip-line-numbers option
. \" skip-line-numbers option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- skip\- line\- numbers\fR ,
\fB \- L\fR
.sp
2010-04-28 15:06:11 +02:00
Do not write line numbers for errors\& . Useful when you want to compare result files that include error messages\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: socket option
. \" socket option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- socket=\fR \fB \fI path\fR \fR ,
\fB \- S \fR \fB \fI path\fR \fR
.sp
For connections to
2009-09-16 14:03:18 +02:00
localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: SSL options
. \" SSL options: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- ssl\fR
2015-09-17 14:34:03 +02:00
.sp
Enable SSL for connection (automatically enabled with other flags). Disable with
\fB \- \- skip-ssl\fR \& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: SSL CA option
. \" SSL CA option: mysql
\fB \- \- ssl\- ca=\fI name\fR
.sp
CA file in PEM format (check OpenSSL docs, implies
\fB \- \- ssl\fR )\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: SSL CA Path option
. \" SSL CA Path option: mysql
\fB \- \- ssl\- capath=\fI name\fR
.sp
CA directory (check OpenSSL docs, implies
\fB \- \- ssl\fR )\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: SSL Cert option
. \" SSL Cert option: mysql
\fB \- \- ssl\- cert=\fI name\fR
.sp
X509 cert in PEM format (check OpenSSL docs, implies
\fB \- \- ssl\fR )\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: SSL Cipher option
. \" SSL Cipher option: mysql
\fB \- \- ssl\- cipher=\fI name\fR
.sp
SSL cipher to use (check OpenSSL docs, implies
\fB \- \- ssl\fR )\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: SSL Key option
. \" SSL Key option: mysql
\fB \- \- ssl\- key=\fI name\fR
.sp
X509 key in PEM format (check OpenSSL docs, implies
\fB \- \- ssl\fR )\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: SSL Crl option
. \" SSL CRL option: mysql
\fB \- \- ssl\- crl=\fI name\fR
.sp
Certificate revocation list (check OpenSSL docs, implies
\fB \- \- ssl\fR )\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: SSL Crlpath option
. \" SSL Crlpath option: mysql
\fB \- \- ssl\- crlpath=\fI name\fR
.sp
Certificate revocation list path (check OpenSSL docs, implies
\fB \- \- ssl\fR )\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: SSL Verify Server Cert option
. \" SSL Verify Server Cert option: mysql
\fB \- \- ssl\- verify\- server\- cert\fR
.sp
Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: table option
. \" table option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- table\fR ,
\fB \- t\fR
.sp
2009-09-16 14:03:18 +02:00
Display output in table format\& . This is the default for interactive use, but can be used to produce table output in batch mode\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: tee option
. \" tee option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- tee=\fR \fB \fI file_name\fR \fR
.sp
2009-12-01 08:24:05 +01:00
Append a copy of output to the given file\& . This option works only in interactive mode\& .
2009-09-16 14:03:18 +02:00
the section called \(lq MYSQL COMMANDS\(rq , discusses tee files further\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: unbuffered option
. \" unbuffered option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- unbuffered\fR ,
\fB \- n\fR
.sp
2009-09-16 14:03:18 +02:00
Flush the buffer after each query\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: user option
. \" user option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- user=\fR \fB \fI user_name\fR \fR ,
\fB \- u \fR \fB \fI user_name\fR \fR
.sp
2015-09-17 14:34:03 +02:00
The MariaDB user name to use when connecting to the server\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: verbose option
. \" verbose option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- verbose\fR ,
\fB \- v\fR
.sp
2009-09-16 14:03:18 +02:00
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,
2009-05-25 11:59:47 +02:00
\fB \- v \- v \- v\fR
2009-09-16 14:03:18 +02:00
produces table output format even in batch mode\& .)
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: version option
. \" version option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- version\fR ,
\fB \- V\fR
.sp
2009-09-16 14:03:18 +02:00
Display version information and exit\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: vertical option
. \" vertical option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- vertical\fR ,
\fB \- E\fR
.sp
2009-09-16 14:03:18 +02:00
Print query output rows vertically (one line per column value)\& . Without this option, you can specify vertical output for individual statements by terminating them with
\e G\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: wait option
. \" wait option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- wait\fR ,
\fB \- w\fR
.sp
2009-09-16 14:03:18 +02:00
If the connection cannot be established, wait and retry instead of aborting\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: xml option
. \" xml option: mysql
2009-05-25 11:59:47 +02:00
\fB \- \- xml\fR ,
\fB \- X\fR
.sp
2009-09-16 14:03:18 +02:00
Produce XML output\& .
2015-09-17 14:34:03 +02:00
The output when
2009-05-25 11:59:47 +02:00
\fB \- \- xml\fR
is used with
\fB mysql\fR
matches that of
2009-09-16 14:03:18 +02:00
\fB mysqldump \fR \fB \fB \- \- xml\fR \fR \& . See
2009-05-25 11:59:47 +02:00
\fB mysqldump\fR (1)
2009-09-16 14:03:18 +02:00
for details\& .
2009-05-25 11:59:47 +02:00
.sp
2015-09-17 14:34:03 +02:00
The XML output also uses an XML namespace, as shown here:
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
shell> \fB mysql \- \- xml \- uroot \- e "SHOW VARIABLES LIKE \' version%\' "\fR
<?xml version="1\& .0"?>
<resultset statement="SHOW VARIABLES LIKE \' version%\' " xmlns:xsi="http://www\& .w3\& .org/2001/XMLSchema\- instance">
2009-05-25 11:59:47 +02:00
<row>
<field name="Variable_name">version</field>
2009-09-16 14:03:18 +02:00
<field name="Value">5\& .0\& .40\- debug</field>
2009-05-25 11:59:47 +02:00
</row>
<row>
<field name="Variable_name">version_comment</field>
<field name="Value">Source distribution</field>
</row>
<row>
<field name="Variable_name">version_compile_machine</field>
<field name="Value">i686</field>
</row>
<row>
<field name="Variable_name">version_compile_os</field>
<field name="Value">suse\- linux\- gnu</field>
</row>
</resultset>
.fi
.RE
.PP
You can also set the following variables by using
2015-09-17 14:34:03 +02:00
\fB \- \- \fR \fB \fI var_name\fR \fR \fB =\fR \fB \fI value\fR \fR \& .
2009-09-16 14:03:18 +02:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" timeout: connect_timeout variable
. \" connect_timeout variable
2009-05-25 11:59:47 +02:00
connect_timeout
.sp
2009-09-16 14:03:18 +02:00
The number of seconds before connection timeout\& . (Default value is
0\& .)
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" max_allowed_packet variable
2009-05-25 11:59:47 +02:00
max_allowed_packet
.sp
2009-09-16 14:03:18 +02:00
The maximum packet length to send to or receive from the server\& . (Default value is 16MB\& .)
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" max_join_size variable
2009-05-25 11:59:47 +02:00
max_join_size
.sp
The automatic limit for rows in a join when using
2009-09-16 14:03:18 +02:00
\fB \- \- safe\- updates\fR \& . (Default value is 1,000,000\& .)
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" net_buffer_length variable
2009-05-25 11:59:47 +02:00
net_buffer_length
.sp
2009-09-16 14:03:18 +02:00
The buffer size for TCP/IP and socket communication\& . (Default value is 16KB\& .)
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" select_limit variable
2009-05-25 11:59:47 +02:00
select_limit
.sp
The automatic limit for
SELECT
statements when using
2009-09-16 14:03:18 +02:00
\fB \- \- safe\- updates\fR \& . (Default value is 1,000\& .)
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \" MYSQL_HISTFILE environment variable
. \" environment variable: MYSQL_HISTFILE
. \" HOME environment variable
. \" environment variable: HOME
. \" mysql history file
. \" command-line history: mysql
. \" .mysql_history file
2009-05-25 11:59:47 +02:00
.PP
On Unix, the
\fB mysql\fR
2009-09-16 14:03:18 +02:00
client writes a record of executed statements to a history file\& . By default, this file is named
\& .mysql_history
and is created in your home directory\& . To specify a different file, set the value of the
2009-05-25 11:59:47 +02:00
MYSQL_HISTFILE
2009-09-16 14:03:18 +02:00
environment variable\& .
2009-05-25 11:59:47 +02:00
.PP
The
2009-09-16 14:03:18 +02:00
\& .mysql_history
2015-09-17 14:34:03 +02:00
should be protected with a restrictive access mode because sensitive information might be written to it, such as the text of SQL statements that contain passwords\& .
2009-05-25 11:59:47 +02:00
.PP
If you do not want to maintain a history file, first remove
2009-09-16 14:03:18 +02:00
\& .mysql_history
2009-05-25 11:59:47 +02:00
if it exists, and then use either of the following techniques:
2009-09-16 14:03:18 +02:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-05-25 11:59:47 +02:00
Set the
MYSQL_HISTFILE
variable to
2009-09-16 14:03:18 +02:00
/dev/null\& . To cause this setting to take effect each time you log in, put the setting in one of your shell\' s startup files\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-05-25 11:59:47 +02:00
Create
2009-09-16 14:03:18 +02:00
\& .mysql_history
2009-05-25 11:59:47 +02:00
as a symbolic link to
2009-09-16 14:03:18 +02:00
/dev/null:
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
shell> \fB ln \- s /dev/null $HOME/\& .mysql_history\fR
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
.RE
. \}
.sp
You need do this only once\& .
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
.SH "MYSQL COMMANDS"
2009-05-25 11:59:47 +02:00
.PP
\fB mysql\fR
2009-09-16 14:03:18 +02:00
sends each SQL statement that you issue to the server to be executed\& . There is also a set of commands that
2009-05-25 11:59:47 +02:00
\fB mysql\fR
2009-09-16 14:03:18 +02:00
itself interprets\& . For a list of these commands, type
2009-05-25 11:59:47 +02:00
help
or
2009-09-16 14:03:18 +02:00
\e h
2009-05-25 11:59:47 +02:00
at the
mysql>
prompt:
2009-09-16 14:03:18 +02:00
. \" mysql commands: list of
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
mysql> \fB help\fR
List of all MySQL commands:
2009-09-16 14:03:18 +02:00
Note that all text commands must be first on line and end with \' ;\'
? (\e ?) Synonym for `help\' \& .
clear (\e c) Clear command\& .
connect (\e r) Reconnect to the server\& . Optional arguments are db and host\& .
delimiter (\e d) Set statement delimiter\& .
edit (\e e) Edit command with $EDITOR\& .
ego (\e G) Send command to mysql server, display result vertically\& .
exit (\e q) Exit mysql\& . Same as quit\& .
go (\e g) Send command to mysql server\& .
help (\e h) Display this help\& .
nopager (\e n) Disable pager, print to stdout\& .
notee (\e t) Don\' t write into outfile\& .
pager (\e P) Set PAGER [to_pager]\& . Print the query results via PAGER\& .
print (\e p) Print current command\& .
prompt (\e R) Change your mysql prompt\& .
quit (\e q) Quit mysql\& .
rehash (\e #) Rebuild completion hash\& .
source (\e \& .) Execute an SQL script file\& . Takes a file name as an argument\& .
status (\e s) Get status information from the server\& .
system (\e !) Execute a system shell command\& .
tee (\e T) Set outfile [to_outfile]\& . Append everything into given
outfile\& .
use (\e u) Use another database\& . Takes database name as argument\& .
charset (\e C) Switch to another charset\& . Might be needed for processing
binlog with multi\- byte charsets\& .
warnings (\e W) Show warnings after every statement\& .
nowarning (\e w) Don\' t show warnings after every statement\& .
For server side help, type \' help contents\'
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
2009-09-16 14:03:18 +02:00
Each command has both a long and short form\& . The long form is not case sensitive; the short form is\& . The long form can be followed by an optional semicolon terminator, but the short form should not\& .
2009-05-25 11:59:47 +02:00
.PP
The use of short\- form commands within multi\- line
2009-09-16 14:03:18 +02:00
/* \& .\& .\& . */
comments is not supported\& .
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: help command
. \" help command: mysql
2009-05-25 11:59:47 +02:00
\fB help [\fR \fB \fI arg\fR \fR \fB ]\fR ,
2009-09-16 14:03:18 +02:00
\fB \e h [\fR \fB \fI arg\fR \fR \fB ]\fR ,
\fB \e ? [\fR \fB \fI arg\fR \fR \fB ]\fR ,
2009-05-25 11:59:47 +02:00
\fB ? [\fR \fB \fI arg\fR \fR \fB ]\fR
.sp
2009-09-16 14:03:18 +02:00
Display a help message listing the available
2009-05-25 11:59:47 +02:00
\fB mysql\fR
2009-09-16 14:03:18 +02:00
commands\& .
2009-05-25 11:59:47 +02:00
.sp
If you provide an argument to the
help
command,
\fB mysql\fR
2015-09-17 14:34:03 +02:00
uses it as a search string to access server\- side help\& . For more information, see
2009-09-16 14:03:18 +02:00
the section called \(lq MYSQL SERVER-SIDE HELP\(rq \& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: charset command
. \" charset command: mysql
2009-05-25 11:59:47 +02:00
\fB charset \fR \fB \fI charset_name\fR \fR ,
2009-09-16 14:03:18 +02:00
\fB \e C \fR \fB \fI charset_name\fR \fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Change the default character set and issue a
2009-05-25 11:59:47 +02:00
SET NAMES
2009-09-16 14:03:18 +02:00
statement\& . This enables the character set to remain synchronized on the client and server if
2009-05-25 11:59:47 +02:00
\fB mysql\fR
2015-09-17 14:34:03 +02:00
is run with auto\- reconnect enabled (which is not recommended), because the specified character set is used for reconnects\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: clear command
. \" clear command: mysql
2009-05-25 11:59:47 +02:00
\fB clear\fR ,
2009-09-16 14:03:18 +02:00
\fB \e c\fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Clear the current input\& . Use this if you change your mind about executing the statement that you are entering\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: connect command
. \" connect command: mysql
2009-05-25 11:59:47 +02:00
\fB connect [\fR \fB \fI db_name\fR \fR \fB \fR \fB \fI host_name\fR \fR \fB ]]\fR ,
2009-09-16 14:03:18 +02:00
\fB \e r [\fR \fB \fI db_name\fR \fR \fB \fR \fB \fI host_name\fR \fR \fB ]]\fR
.sp
Reconnect to the server\& . The optional database name and host name arguments may be given to specify the default database or the host where the server is running\& . If omitted, the current values are used\& .
.RE
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: delimiter command
. \" delimiter command: mysql
2009-05-25 11:59:47 +02:00
\fB delimiter \fR \fB \fI str\fR \fR ,
2009-09-16 14:03:18 +02:00
\fB \e d \fR \fB \fI str\fR \fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Change the string that
2009-05-25 11:59:47 +02:00
\fB mysql\fR
2009-09-16 14:03:18 +02:00
interprets as the separator between SQL statements\& . The default is the semicolon character (\(lq ;\(rq )\& .
2009-05-25 11:59:47 +02:00
.sp
2015-09-17 14:34:03 +02:00
The delimiter can be specified as an unquoted or quoted argument\& . Quoting can be done with either single quote (\' ) or douple quote (") characters\& . To include a quote within a quoted string, either quote the string with the other quote character or escape the quote with a backslash (\(lq \e \(rq ) character\& . Backslash should be avoided outside of quoted strings because it is the escape character for MariaDB\& . For an unquoted argument, the delmiter is read up to the first space or end of line\& . For a quoted argument, the delimiter is read up to the matching quote on the line\& .
2009-05-25 11:59:47 +02:00
.sp
When the delimiter recognized by
\fB mysql\fR
is set to something other than the default of
2009-09-16 14:03:18 +02:00
\(lq ;\(rq , instances of that character are sent to the server without interpretation\& . However, the server itself still interprets
2009-05-25 11:59:47 +02:00
\(lq ;\(rq
2015-09-17 14:34:03 +02:00
as a statement delimiter and processes statements accordingly\& . This behavior on the server side comes into play for multiple\- statement execution, and for parsing the body of stored procedures and functions, triggers, and events\& .
2009-09-16 14:03:18 +02:00
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: edit command
. \" edit command: mysql
2009-05-25 11:59:47 +02:00
\fB edit\fR ,
2009-09-16 14:03:18 +02:00
\fB \e e\fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Edit the current input statement\& .
2009-05-25 11:59:47 +02:00
\fB mysql\fR
checks the values of the
EDITOR
and
VISUAL
2009-09-16 14:03:18 +02:00
environment variables to determine which editor to use\& . The default editor is
2009-05-25 11:59:47 +02:00
\fB vi\fR
2009-09-16 14:03:18 +02:00
if neither variable is set\& .
2009-05-25 11:59:47 +02:00
.sp
The
\fB edit\fR
2009-09-16 14:03:18 +02:00
command works only in Unix\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: ego command
. \" ego command: mysql
2009-05-25 11:59:47 +02:00
\fB ego\fR ,
2009-09-16 14:03:18 +02:00
\fB \e G\fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Send the current statement to the server to be executed and display the result using vertical format\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: exit command
. \" exit command: mysql
2009-05-25 11:59:47 +02:00
\fB exit\fR ,
2009-09-16 14:03:18 +02:00
\fB \e q\fR
.sp
Exit
\fB mysql\fR \& .
.RE
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: go command
. \" go command: mysql
2009-05-25 11:59:47 +02:00
\fB go\fR ,
2009-09-16 14:03:18 +02:00
\fB \e g\fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Send the current statement to the server to be executed\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: nopager command
. \" nopager command: mysql
2009-05-25 11:59:47 +02:00
\fB nopager\fR ,
2009-09-16 14:03:18 +02:00
\fB \e n\fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Disable output paging\& . See the description for
\fB pager\fR \& .
2009-05-25 11:59:47 +02:00
.sp
The
\fB nopager\fR
2009-09-16 14:03:18 +02:00
command works only in Unix\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: notee command
. \" notee command: mysql
2009-05-25 11:59:47 +02:00
\fB notee\fR ,
2009-09-16 14:03:18 +02:00
\fB \e t\fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Disable output copying to the tee file\& . See the description for
\fB tee\fR \& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: nowarning command
. \" nowarning command: mysql
2009-05-25 11:59:47 +02:00
\fB nowarning\fR ,
2009-09-16 14:03:18 +02:00
\fB \e w\fR
.sp
Enable display of warnings after each statement\& .
.RE
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: pager command
. \" pager command: mysql
2009-05-25 11:59:47 +02:00
\fB pager [\fR \fB \fI command\fR \fR \fB ]\fR ,
2009-09-16 14:03:18 +02:00
\fB \e P [\fR \fB \fI command\fR \fR \fB ]\fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Enable output paging\& . By using the
2009-05-25 11:59:47 +02:00
\fB \- \- pager\fR
option when you invoke
\fB mysql\fR , it is possible to browse or search query results in interactive mode with Unix programs such as
\fB less\fR ,
2009-09-16 14:03:18 +02:00
\fB more\fR , or any other similar program\& . If you specify no value for the option,
2009-05-25 11:59:47 +02:00
\fB mysql\fR
checks the value of the
PAGER
2009-12-01 08:24:05 +01:00
environment variable and sets the pager to that\& . Pager functionality works only in interactive mode\& .
2009-05-25 11:59:47 +02:00
.sp
Output paging can be enabled interactively with the
\fB pager\fR
command and disabled with
2009-09-16 14:03:18 +02:00
\fB nopager\fR \& . The command takes an optional argument; if given, the paging program is set to that\& . With no argument, the pager is set to the pager that was set on the command line, or
2009-05-25 11:59:47 +02:00
stdout
2009-09-16 14:03:18 +02:00
if no pager was specified\& .
2009-05-25 11:59:47 +02:00
.sp
Output paging works only in Unix because it uses the
popen()
2009-09-16 14:03:18 +02:00
function, which does not exist on Windows\& . For Windows, the
2009-05-25 11:59:47 +02:00
\fB tee\fR
option can be used instead to save query output, although it is not as convenient as
\fB pager\fR
2009-09-16 14:03:18 +02:00
for browsing output in some situations\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: print command
. \" print command: mysql
2009-05-25 11:59:47 +02:00
\fB print\fR ,
2009-09-16 14:03:18 +02:00
\fB \e p\fR
.sp
Print the current input statement without executing it\& .
.RE
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: prompt command
. \" prompt command: mysql
2009-05-25 11:59:47 +02:00
\fB prompt [\fR \fB \fI str\fR \fR \fB ]\fR ,
2009-09-16 14:03:18 +02:00
\fB \e R [\fR \fB \fI str\fR \fR \fB ]\fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Reconfigure the
2009-05-25 11:59:47 +02:00
\fB mysql\fR
2009-09-16 14:03:18 +02:00
prompt to the given string\& . The special character sequences that can be used in the prompt are described later in this section\& .
2009-05-25 11:59:47 +02:00
.sp
If you specify the
prompt
command with no argument,
\fB mysql\fR
resets the prompt to the default of
2009-09-16 14:03:18 +02:00
mysql>\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: quit command
. \" quit command: mysql
2009-05-25 11:59:47 +02:00
\fB quit\fR ,
2009-09-16 14:03:18 +02:00
\fB \e q\fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Exit
\fB mysql\fR \& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: rehash command
. \" rehash command: mysql
2009-05-25 11:59:47 +02:00
\fB rehash\fR ,
2009-09-16 14:03:18 +02:00
\fB \e #\fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Rebuild the completion hash that enables database, table, and column name completion while you are entering statements\& . (See the description for the
2009-05-25 11:59:47 +02:00
\fB \- \- auto\- rehash\fR
2009-09-16 14:03:18 +02:00
option\& .)
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: source command
. \" source command: mysql
2009-05-25 11:59:47 +02:00
\fB source \fR \fB \fI file_name\fR \fR ,
2009-09-16 14:03:18 +02:00
\fB \e \& . \fR \fB \fI file_name\fR \fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Read the named file and executes the statements contained therein\& . On Windows, you can specify path name separators as
2009-05-25 11:59:47 +02:00
/
or
2009-09-16 14:03:18 +02:00
\e \e \& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: status command
. \" status command: mysql
2009-05-25 11:59:47 +02:00
\fB status\fR ,
2009-09-16 14:03:18 +02:00
\fB \e s\fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Provide status information about the connection and the server you are using\& . If you are running in
2009-05-25 11:59:47 +02:00
\fB \- \- safe\- updates\fR
mode,
status
also prints the values for the
\fB mysql\fR
2009-09-16 14:03:18 +02:00
variables that affect your queries\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: system command
. \" system command: mysql
2009-05-25 11:59:47 +02:00
\fB system \fR \fB \fI command\fR \fR ,
2009-09-16 14:03:18 +02:00
\fB \e ! \fR \fB \fI command\fR \fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Execute the given command using your default command interpreter\& .
2009-05-25 11:59:47 +02:00
.sp
The
\fB system\fR
2009-09-16 14:03:18 +02:00
command works only in Unix\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: tee command
. \" tee command: mysql
2009-05-25 11:59:47 +02:00
\fB tee [\fR \fB \fI file_name\fR \fR \fB ]\fR ,
2009-09-16 14:03:18 +02:00
\fB \e T [\fR \fB \fI file_name\fR \fR \fB ]\fR
2009-05-25 11:59:47 +02:00
.sp
By using the
\fB \- \- tee\fR
option when you invoke
2009-09-16 14:03:18 +02:00
\fB mysql\fR , you can log statements and their output\& . All the data displayed on the screen is appended into a given file\& . This can be very useful for debugging purposes also\& .
2009-05-25 11:59:47 +02:00
\fB mysql\fR
2009-12-01 08:24:05 +01:00
flushes results to the file after each statement, just before it prints its next prompt\& . Tee functionality works only in interactive mode\& .
2009-05-25 11:59:47 +02:00
.sp
You can enable this feature interactively with the
\fB tee\fR
2009-09-16 14:03:18 +02:00
command\& . Without a parameter, the previous file is used\& . The
2009-05-25 11:59:47 +02:00
\fB tee\fR
file can be disabled with the
\fB notee\fR
2009-09-16 14:03:18 +02:00
command\& . Executing
2009-05-25 11:59:47 +02:00
\fB tee\fR
2009-09-16 14:03:18 +02:00
again re\- enables logging\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: use command
. \" use command: mysql
2009-05-25 11:59:47 +02:00
\fB use \fR \fB \fI db_name\fR \fR ,
2009-09-16 14:03:18 +02:00
\fB \e u \fR \fB \fI db_name\fR \fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Use
2009-05-25 11:59:47 +02:00
\fI db_name\fR
2009-09-16 14:03:18 +02:00
as the default database\& .
.RE
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
. \" mysql: warnings command
. \" warnings command: mysql
\fB warnings\fR ,
\fB \e W\fR
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
Enable display of warnings after each statement (if there are any)\& .
2009-05-25 11:59:47 +02:00
.RE
.PP
Here are a few tips about the
\fB pager\fR
command:
2009-09-16 14:03:18 +02:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-05-25 11:59:47 +02:00
You can use it to write to a file and the results go only to the file:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
mysql> \fB pager cat > /tmp/log\& .txt\fR
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
.sp
2009-05-25 11:59:47 +02:00
You can also pass any options for the program that you want to use as your pager:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
mysql> \fB pager less \- n \- i \- S\fR
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
.RE
. \}
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-05-25 11:59:47 +02:00
In the preceding example, note the
\fB \- S\fR
2009-09-16 14:03:18 +02:00
option\& . You may find it very useful for browsing wide query results\& . Sometimes a very wide result set is difficult to read on the screen\& . The
2009-05-25 11:59:47 +02:00
\fB \- S\fR
option to
\fB less\fR
2009-09-16 14:03:18 +02:00
can make the result set much more readable because you can scroll it horizontally using the left\- arrow and right\- arrow keys\& . You can also use
2009-05-25 11:59:47 +02:00
\fB \- S\fR
interactively within
\fB less\fR
2009-09-16 14:03:18 +02:00
to switch the horizontal\- browse mode on and off\& . For more information, read the
2009-05-25 11:59:47 +02:00
\fB less\fR
manual page:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
shell> \fB man less\fR
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
.RE
. \}
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-05-25 11:59:47 +02:00
The
\fB \- F\fR
and
\fB \- X\fR
options may be used with
\fB less\fR
to cause it to exit if output fits on one screen, which is convenient when no scrolling is necessary:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
mysql> \fB pager less \- n \- i \- S \- F \- X\fR
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
.RE
. \}
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-05-25 11:59:47 +02:00
You can specify very complex pager commands for handling query output:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
mysql> \fB pager cat | tee /dr1/tmp/res\& .txt \e \fR
\fB | tee /dr2/tmp/res2\& .txt | less \- n \- i \- S\fR
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
.sp
2009-05-25 11:59:47 +02:00
In this example, the command would send query results to two files in two different directories on two different file systems mounted on
2009-09-16 14:03:18 +02:00
/dr1
2009-05-25 11:59:47 +02:00
and
2009-09-16 14:03:18 +02:00
/dr2, yet still display the results onscreen via
\fB less\fR \& .
2009-05-25 11:59:47 +02:00
.RE
.PP
You can also combine the
\fB tee\fR
and
\fB pager\fR
2009-09-16 14:03:18 +02:00
functions\& . Have a
2009-05-25 11:59:47 +02:00
\fB tee\fR
file enabled and
\fB pager\fR
set to
\fB less\fR , and you are able to browse the results using the
\fB less\fR
2009-09-16 14:03:18 +02:00
program and still have everything appended into a file the same time\& . The difference between the Unix
2009-05-25 11:59:47 +02:00
\fB tee\fR
used with the
\fB pager\fR
command and the
\fB mysql\fR
built\- in
\fB tee\fR
command is that the built\- in
\fB tee\fR
works even if you do not have the Unix
\fB tee\fR
2009-09-16 14:03:18 +02:00
available\& . The built\- in
2009-05-25 11:59:47 +02:00
\fB tee\fR
also logs everything that is printed on the screen, whereas the Unix
\fB tee\fR
used with
\fB pager\fR
2009-09-16 14:03:18 +02:00
does not log quite that much\& . Additionally,
2009-05-25 11:59:47 +02:00
\fB tee\fR
file logging can be turned on and off interactively from within
2009-09-16 14:03:18 +02:00
\fB mysql\fR \& . This is useful when you want to log some queries to a file, but not others\& .
. \" mysql prompt command
2009-05-25 11:59:47 +02:00
.PP
The
\fB prompt\fR
command reconfigures the default
mysql>
2009-09-16 14:03:18 +02:00
prompt\& . The string for defining the prompt can contain the following special sequences\& .
2009-05-25 11:59:47 +02:00
.TS
allbox tab(:);
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l
l l.
T{
\fB Option\fR
T}:T{
\fB Description\fR
T}
T{
2009-09-16 14:03:18 +02:00
\e c
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
A counter that increments for each statement you issue
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e D
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
The full current date
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e d
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
The default database
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e h
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
The server host
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e l
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
The current delimiter (new in 5\& .1\& .12)
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e m
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
Minutes of the current time
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e n
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
A newline character
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e O
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
The current month in three\- letter format (Jan, Feb, \& ...)
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e o
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
The current month in numeric format
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e P
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
am/pm
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e p
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
The current TCP/IP port or socket file
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e R
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
The current time, in 24\- hour military time (0\(en 23)
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e r
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
The current time, standard 12\- hour time (1\(en 12)
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e S
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
Semicolon
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e s
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
Seconds of the current time
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e t
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
A tab character
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e U
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
.PP
Your full
\fI user_name\fR @\fI host_name\fR
account name
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e u
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
Your user name
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e v
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
The server version
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e w
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
The current day of the week in three\- letter format (Mon, Tue, \& ...)
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e Y
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
The current year, four digits
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e y
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
The current year, two digits
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e _
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
A space
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e \ \&
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
A space (a space follows the backslash)
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e \'
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
Single quote
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e "
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
Double quote
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e \e
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
A literal \(lq \e \(rq backslash character
2009-05-25 11:59:47 +02:00
T}
T{
2009-09-16 14:03:18 +02:00
\e \fI x\fR
2009-05-25 11:59:47 +02:00
T}:T{
2009-09-16 14:03:18 +02:00
.PP
\fI x\fR , for any
\(lq \fI x\fR \(rq
not listed above
2009-05-25 11:59:47 +02:00
T}
.TE
2009-09-16 14:03:18 +02:00
.sp 1
2009-05-25 11:59:47 +02:00
.PP
You can set the prompt in several ways:
2009-09-16 14:03:18 +02:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
\fI Use an environment variable\& .\fR
2009-05-25 11:59:47 +02:00
You can set the
MYSQL_PS1
2009-09-16 14:03:18 +02:00
environment variable to a prompt string\& . For example:
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
shell> \fB export MYSQL_PS1="(\e u@\e h) [\e d]> "\fR
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
.RE
. \}
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
\fI Use a command\- line option\& .\fR
2009-05-25 11:59:47 +02:00
You can set the
\fB \- \- prompt\fR
option on the command line to
2009-09-16 14:03:18 +02:00
\fB mysql\fR \& . For example:
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
shell> \fB mysql \- \- prompt="(\e u@\e h) [\e d]> "\fR
2009-05-25 11:59:47 +02:00
(user@host) [database]>
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
.RE
. \}
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
\fI Use an option file\& .\fR
2009-05-25 11:59:47 +02:00
You can set the
prompt
option in the
[mysql]
2015-09-17 14:34:03 +02:00
group of any MariaDB option file, such as
2009-09-16 14:03:18 +02:00
/etc/my\& .cnf
2009-05-25 11:59:47 +02:00
or the
2009-09-16 14:03:18 +02:00
\& .my\& .cnf
file in your home directory\& . For example:
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
[mysql]
2009-09-16 14:03:18 +02:00
prompt=(\e \e u@\e \e h) [\e \e d]>\e \e _
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
.sp
In this example, note that the backslashes are doubled\& . If you set the prompt using the
2009-05-25 11:59:47 +02:00
prompt
2015-09-17 14:34:03 +02:00
option in an option file, it is advisable to double the backslashes when using the special prompt options\& . There is some overlap in the set of allowable prompt options and the set of special escape sequences that are recognized in option files\& . The overlap may cause you problems if you use single backslashes\& . For example,
2009-09-16 14:03:18 +02:00
\e s
is interpreted as a space rather than as the current seconds value\& . The following example shows how to define a prompt within an option file to include the current time in
2009-05-25 11:59:47 +02:00
HH:MM:SS>
format:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
[mysql]
2009-09-16 14:03:18 +02:00
prompt="\e \e r:\e \e m:\e \e s> "
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
\fI Set the prompt interactively\& .\fR
2009-05-25 11:59:47 +02:00
You can change your prompt interactively by using the
prompt
(or
2009-09-16 14:03:18 +02:00
\e R) command\& . For example:
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
mysql> \fB prompt (\e u@\e h) [\e d]>\e _\fR
PROMPT set to \' (\e u@\e h) [\e d]>\e _\'
2009-05-25 11:59:47 +02:00
(\fI user\fR @\fI host\fR ) [\fI database\fR ]>
(\fI user\fR @\fI host\fR ) [\fI database\fR ]> prompt
Returning to default PROMPT of mysql>
mysql>
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
.RE
.SH "MYSQL SERVER-SIDE HELP"
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
mysql> \fB help \fR \fB \fI search_string\fR \fR
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
If you provide an argument to the
help
command,
\fB mysql\fR
2015-09-17 14:34:03 +02:00
uses it as a search string to access server\- side help\& . The proper operation of this command requires that the help tables in the
2009-05-25 11:59:47 +02:00
mysql
2015-09-17 14:34:03 +02:00
database be initialized with help topic information.
2009-05-25 11:59:47 +02:00
.PP
If there is no match for the search string, the search fails:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
mysql> \fB help me\fR
Nothing found
2009-09-16 14:03:18 +02:00
Please try to run \' help contents\' for a list of all accessible topics
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
Use
\fB help contents\fR
to see a list of the help categories:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
mysql> \fB help contents\fR
You asked for help about help category: "Contents"
2009-09-16 14:03:18 +02:00
For more information, type \' help <item>\' , where <item> is one of the
2009-05-25 11:59:47 +02:00
following categories:
Account Management
Administration
Data Definition
Data Manipulation
Data Types
Functions
Functions and Modifiers for Use with GROUP BY
Geographic Features
Language Structure
Plugins
Storage Engines
Stored Routines
Table Maintenance
Transactions
Triggers
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
If the search string matches multiple items,
\fB mysql\fR
shows a list of matching topics:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
mysql> \fB help logs\fR
2009-09-16 14:03:18 +02:00
Many help items for your request exist\& .
To make a more specific request, please type \' help <item>\' ,
2009-05-25 11:59:47 +02:00
where <item> is one of the following topics:
SHOW
SHOW BINARY LOGS
SHOW ENGINE
SHOW LOGS
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
Use a topic as the search string to see the help entry for that topic:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
mysql> \fB help show binary logs\fR
2009-09-16 14:03:18 +02:00
Name: \' SHOW BINARY LOGS\'
2009-05-25 11:59:47 +02:00
Description:
Syntax:
SHOW BINARY LOGS
SHOW MASTER LOGS
2009-09-16 14:03:18 +02:00
Lists the binary log files on the server\& . This statement is used as
2009-05-25 11:59:47 +02:00
part of the procedure described in [purge\- binary\- logs], that shows how
2009-09-16 14:03:18 +02:00
to determine which logs can be purged\& .
2009-05-25 11:59:47 +02:00
mysql> SHOW BINARY LOGS;
+\- \- \- \- \- \- \- \- \- \- \- \- \- \- \- +\- \- \- \- \- \- \- \- \- \- \- +
| Log_name | File_size |
+\- \- \- \- \- \- \- \- \- \- \- \- \- \- \- +\- \- \- \- \- \- \- \- \- \- \- +
2009-09-16 14:03:18 +02:00
| binlog\& .000015 | 724935 |
| binlog\& .000016 | 733481 |
2009-05-25 11:59:47 +02:00
+\- \- \- \- \- \- \- \- \- \- \- \- \- \- \- +\- \- \- \- \- \- \- \- \- \- \- +
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.SH "EXECUTING SQL STATEMENTS FROM A TEXT FILE"
2009-09-16 14:03:18 +02:00
. \" executing SQL statements from text files
. \" importing: data
. \" data: importing
. \" files: text
. \" text files: importing
. \" source (mysql client command)
. \" \. (mysql client command)
. \" mysql source (command for reading from text files)
. \" mysql \. (command for reading from text files)
2009-05-25 11:59:47 +02:00
.PP
The
\fB mysql\fR
client typically is used interactively, like this:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
shell> \fB mysql \fR \fB \fI db_name\fR \fR
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
However, it is also possible to put your SQL statements in a file and then tell
\fB mysql\fR
2009-09-16 14:03:18 +02:00
to read its input from that file\& . To do so, create a text file
2009-05-25 11:59:47 +02:00
\fI text_file\fR
2009-09-16 14:03:18 +02:00
that contains the statements you wish to execute\& . Then invoke
2009-05-25 11:59:47 +02:00
\fB mysql\fR
as shown here:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
shell> \fB mysql \fR \fB \fI db_name\fR \fR \fB < \fR \fB \fI text_file\fR \fR
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
If you place a
USE \fI db_name\fR
statement as the first statement in the file, it is unnecessary to specify the database name on the command line:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
shell> \fB mysql < text_file\fR
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
If you are already running
\fB mysql\fR , you can execute an SQL script file using the
source
command or
2009-09-16 14:03:18 +02:00
\e \& .
2009-05-25 11:59:47 +02:00
command:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
mysql> \fB source \fR \fB \fI file_name\fR \fR
2009-09-16 14:03:18 +02:00
mysql> \fB \e \& . \fR \fB \fI file_name\fR \fR
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
2009-09-16 14:03:18 +02:00
Sometimes you may want your script to display progress information to the user\& . For this you can insert statements like this:
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
SELECT \' <info_to_display>\' AS \' \' ;
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
The statement shown outputs
2009-09-16 14:03:18 +02:00
<info_to_display>\& .
2009-05-25 11:59:47 +02:00
.PP
2009-12-01 08:24:05 +01:00
You can also invoke
\fB mysql\fR
with the
\fB \- \- verbose\fR
option, which causes each statement to be displayed before the result that it produces\& .
.PP
2009-05-25 11:59:47 +02:00
\fB mysql\fR
2015-09-17 14:34:03 +02:00
ignores Unicode byte order mark (BOM) characters at the beginning of input files\& . Presence of a BOM does not cause
2009-05-25 11:59:47 +02:00
\fB mysql\fR
2009-09-16 14:03:18 +02:00
to change its default character set\& . To do that, invoke
2009-05-25 11:59:47 +02:00
\fB mysql\fR
with an option such as
2009-09-16 14:03:18 +02:00
\fB \- \- default\- character\- set=utf8\fR \& .
2009-05-25 11:59:47 +02:00
.PP
2009-09-16 14:03:18 +02:00
.SH "MYSQL TIPS"
2009-05-25 11:59:47 +02:00
.PP
This section describes some techniques that can help you use
\fB mysql\fR
2009-09-16 14:03:18 +02:00
more effectively\& .
2009-05-25 11:59:47 +02:00
.SS "Displaying Query Results Vertically"
.PP
2009-09-16 14:03:18 +02:00
Some query results are much more readable when displayed vertically, instead of in the usual horizontal table format\& . Queries can be displayed vertically by terminating the query with \e G instead of a semicolon\& . For example, longer text values that include newlines often are much easier to read with vertical output:
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2009-09-16 14:03:18 +02:00
mysql> \fB SELECT * FROM mails WHERE LENGTH(txt) < 300 LIMIT 300,1\e G\fR
*************************** 1\& . row ***************************
2009-05-25 11:59:47 +02:00
msg_nro: 3068
date: 2000\- 03\- 01 23:29:50
time_zone: +0200
mail_from: Monty
2009-09-16 14:03:18 +02:00
reply: monty@no\& .spam\& .com
mail_to: "Thimble Smith" <tim@no\& .spam\& .com>
2009-05-25 11:59:47 +02:00
sbj: UTF\- 8
txt: >>>>> "Thimble" == Thimble Smith writes:
2009-09-16 14:03:18 +02:00
Thimble> Hi\& . I think this is a good idea\& . Is anyone familiar
Thimble> with UTF\- 8 or Unicode? Otherwise, I\' ll put this on my
Thimble> TODO list and see what happens\& .
Yes, please do that\& .
2009-05-25 11:59:47 +02:00
Regards,
Monty
file: inbox\- jani\- 1
hash: 190402944
2009-09-16 14:03:18 +02:00
1 row in set (0\& .09 sec)
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.SS "Using the \-\-safe\-updates Option"
2009-09-16 14:03:18 +02:00
. \" safe-updates option
2009-05-25 11:59:47 +02:00
.PP
For beginners, a useful startup option is
\fB \- \- safe\- updates\fR
(or
2009-09-16 14:03:18 +02:00
\fB \- \- i\- am\- a\- dummy\fR , which has the same effect)\& . It is helpful for cases when you might have issued a
2009-05-25 11:59:47 +02:00
DELETE FROM \fI tbl_name\fR
statement but forgotten the
WHERE
2009-09-16 14:03:18 +02:00
clause\& . Normally, such a statement deletes all rows from the table\& . With
\fB \- \- safe\- updates\fR , you can delete rows only by specifying the key values that identify them\& . This helps prevent accidents\& .
2009-05-25 11:59:47 +02:00
.PP
When you use the
\fB \- \- safe\- updates\fR
option,
\fB mysql\fR
2015-09-17 14:34:03 +02:00
issues the following statement when it connects to the MariaDB server:
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
SET sql_safe_updates=1, sql_select_limit=1000, sql_max_join_size=1000000;
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
The
SET
statement has the following effects:
2009-09-16 14:03:18 +02:00
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-05-25 11:59:47 +02:00
You are not allowed to execute an
UPDATE
or
DELETE
statement unless you specify a key constraint in the
WHERE
clause or provide a
LIMIT
2009-09-16 14:03:18 +02:00
clause (or both)\& . For example:
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
UPDATE \fI tbl_name\fR SET \fI not_key_column\fR =\fI val\fR WHERE \fI key_column\fR =\fI val\fR ;
UPDATE \fI tbl_name\fR SET \fI not_key_column\fR =\fI val\fR LIMIT 1;
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-05-25 11:59:47 +02:00
The server limits all large
SELECT
results to 1,000 rows unless the statement includes a
LIMIT
2009-09-16 14:03:18 +02:00
clause\& .
.RE
.sp
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
2009-05-25 11:59:47 +02:00
The server aborts multiple\- table
SELECT
2009-09-16 14:03:18 +02:00
statements that probably need to examine more than 1,000,000 row combinations\& .
2009-05-25 11:59:47 +02:00
.RE
.PP
To specify limits different from 1,000 and 1,000,000, you can override the defaults by using the
2013-06-13 00:13:23 +02:00
\fB \- \- select\- limit\fR
2009-05-25 11:59:47 +02:00
and
2013-06-13 00:13:23 +02:00
\fB \- \- max\- join\- size\fR
2009-05-25 11:59:47 +02:00
options:
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
2013-06-13 00:13:23 +02:00
shell> \fB mysql \- \- safe\- updates \- \- select\- limit=500 \- \- max\- join\- size=10000\fR
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.SS "Disabling mysql Auto\-Reconnect"
.PP
If the
\fB mysql\fR
2009-09-16 14:03:18 +02:00
client loses its connection to the server while sending a statement, it immediately and automatically tries to reconnect once to the server and send the statement again\& . However, even if
2009-05-25 11:59:47 +02:00
\fB mysql\fR
2009-09-16 14:03:18 +02:00
succeeds in reconnecting, your first connection has ended and all your previous session objects and settings are lost: temporary tables, the autocommit mode, and user\- defined and session variables\& . Also, any current transaction rolls back\& . This behavior may be dangerous for you, as in the following example where the server was shut down and restarted between the first and second statements without you knowing it:
2009-05-25 11:59:47 +02:00
.sp
2009-09-16 14:03:18 +02:00
.if n \{ \
.RS 4
. \}
2009-05-25 11:59:47 +02:00
.nf
mysql> \fB SET @a=1;\fR
2009-09-16 14:03:18 +02:00
Query OK, 0 rows affected (0\& .05 sec)
2009-05-25 11:59:47 +02:00
mysql> \fB INSERT INTO t VALUES(@a);\fR
ERROR 2006: MySQL server has gone away
2009-09-16 14:03:18 +02:00
No connection\& . Trying to reconnect\& .\& .\& .
2009-05-25 11:59:47 +02:00
Connection id: 1
Current database: test
2009-09-16 14:03:18 +02:00
Query OK, 1 row affected (1\& .30 sec)
2009-05-25 11:59:47 +02:00
mysql> \fB SELECT * FROM t;\fR
+\- \- \- \- \- \- +
| a |
+\- \- \- \- \- \- +
| NULL |
+\- \- \- \- \- \- +
2009-09-16 14:03:18 +02:00
1 row in set (0\& .05 sec)
2009-05-25 11:59:47 +02:00
.fi
2009-09-16 14:03:18 +02:00
.if n \{ \
2009-05-25 11:59:47 +02:00
.RE
2009-09-16 14:03:18 +02:00
. \}
2009-05-25 11:59:47 +02:00
.PP
The
@a
2009-09-16 14:03:18 +02:00
user variable has been lost with the connection, and after the reconnection it is undefined\& . If it is important to have
2009-05-25 11:59:47 +02:00
\fB mysql\fR
terminate with an error if the connection has been lost, you can start the
\fB mysql\fR
client with the
\fB \- \- skip\- reconnect\fR
2009-09-16 14:03:18 +02:00
option\& .
2009-05-25 11:59:47 +02:00
.PP
.SH "COPYRIGHT"
2009-09-16 14:03:18 +02:00
.br
2009-05-25 11:59:47 +02:00
.PP
2015-09-09 14:32:52 +02:00
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
2009-05-25 11:59:47 +02:00
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
.PP
2019-05-11 20:29:06 +02:00
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA or see http://www.gnu.org/licenses/.
2009-09-16 14:03:18 +02:00
.sp
.SH "NOTES"
.IP " 1." 4
Bug#25946
.RS 4
2010-04-28 15:06:11 +02:00
\% http://bugs.mysql.com/bug.php?id=25946
2009-09-16 14:03:18 +02:00
.RE
2009-05-25 11:59:47 +02:00
.SH "SEE ALSO"
2015-09-09 14:32:52 +02:00
For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
2009-05-25 11:59:47 +02:00
.SH AUTHOR
2015-09-09 14:32:52 +02:00
MariaDB Foundation (http://www.mariadb.org/).