--help , -? Display a help message and exit.

--auto-rehash 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 or its \# shortcut 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. Note This feature requires a MySQL client that is compiled with the readline library. Typically, the readline library is not available on Windows.

--auto-vertical-output Cause result sets to be displayed vertically if they are too wide for the current window, and using normal tabular format otherwise. (This applies to statements terminated by ; or \G .)

--batch , -B Print results using tab as the column separator, with each row on a new line. With this option, mysql does not use the history file. 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 --raw option.

--binary-as-hex When this option is given, mysql displays binary data using hexadecimal notation ( 0x value ). This occurs whether the overall output display format is tabular, vertical, HTML, or XML. --binary-as-hex when enabled affects display of all binary strings, including those returned by functions such as CHAR() and UNHEX() . The following example demonistrates this using the ASCII code for A (65 decimal, 41 hexadecimal): --binary-as-hex disabled: mysql> SELECT CHAR(0x41), UNHEX('41'); +------------+-------------+ | CHAR(0x41) | UNHEX('41') | +------------+-------------+ | A | A | +------------+-------------+

--binary-as-hex enabled: mysql> SELECT CHAR(0x41), UNHEX('41'); +------------------------+--------------------------+ | CHAR(0x41) | UNHEX('41') | +------------------------+--------------------------+ | 0x41 | 0x41 | +------------------------+--------------------------+ To write a binary string expression so that it displays as a character string regardless of whether --binary-as-hex is enabled, use these techniques: The CHAR() function has a USING charset clause: mysql> SELECT CHAR(0x41 USING utf8mb4); +--------------------------+ | CHAR(0x41 USING utf8mb4) | +--------------------------+ | A | +--------------------------+

More generally, use CONVERT() to convert an expression to a given character set: mysql> SELECT CONVERT(UNHEX('41') USING utf8mb4); +------------------------------------+ | CONVERT(UNHEX('41') USING utf8mb4) | +------------------------------------+ | A | +------------------------------------+ This option was added in MySQL 5.6.37.

--binary-mode This option helps when processing mysqlbinlog output that may contain BLOB values. By default, mysql translates \r

in statement strings to

and interprets \0 as the statement terminator. --binary-mode disables both features. It also disables all mysql commands except charset and delimiter in noninteractive mode (for input piped to mysql or loaded using the source command).

--bind-address= ip_address On a computer having multiple network interfaces, use this option to select which interface to use for connecting to the MySQL server.

--comments , -c Whether to strip or preserve comments in statements sent to the server. The default is --skip-comments (strip comments), enable with --comments (preserve comments).

--connect-expired-password Indicate to the server that the client can handle sandbox mode if the account used to connect has an expired password. This can be useful for noninteractive invocations of mysql because normally the server disconnects noninteractive clients that attempt to connect using an account with an expired password. (See Section 6.2.10, “Server Handling of Expired Passwords”.) This option was added in MySQL 5.6.12.

--connect-timeout= value The number of seconds before connection timeout. (Default value is 0 .)

--database= db_name , -D db_name The database to use. This is useful primarily in an option file.

--debug[= debug_options ] , -# [ debug_options ] Write a debugging log. A typical debug_options string is d:t:o, file_name . The default is d:t:o,/tmp/mysql.trace . This option is available only if MySQL was built using WITH_DEBUG . MySQL release binaries provided by Oracle are not built using this option.

--debug-check Print some debugging information when the program exits. This option is available only if MySQL was built using WITH_DEBUG . MySQL release binaries provided by Oracle are not built using this option.

--debug-info , -T Print debugging information and memory and CPU usage statistics when the program exits. This option is available only if MySQL was built using WITH_DEBUG . MySQL release binaries provided by Oracle are not built using this option.

--defaults-extra-file= file_name Read this option file after the global option file but (on Unix) before the user option file. If the file does not exist or is otherwise inaccessible, an error occurs. file_name is interpreted relative to the current directory if given as a relative path name rather than a full path name. For additional information about this and other option-file options, see Section 4.2.2.3, “Command-Line Options that Affect Option-File Handling”.

--delimiter= str Set the statement delimiter. The default is the semicolon character ( ; ).

--disable-named-commands 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 Client Commands”.

--force , -f Continue even if an SQL error occurs.

--histignore A list of one or more colon-separated patterns specifying statements to ignore for logging purposes. These patterns are added to the default pattern list ( "*IDENTIFIED*:*PASSWORD*" ). The value specified for this option affects logging of statements written to the history file. For more information, see Section 4.5.1.3, “mysql Client Logging”.

--init-command=str SQL statement to execute after connecting to the server. If auto-reconnect is enabled, the statement is executed again after reconnection occurs.

--line-numbers Write line numbers for errors. Disable this with --skip-line-numbers .

--max-allowed-packet= value The maximum size of the buffer for client/server communication. The default is 16MB, the maximum is 1GB.

--max-join-size= value The automatic limit for rows in a join when using --safe-updates . (Default value is 1,000,000.)

--net-buffer-length= value The buffer size for TCP/IP and socket communication. (Default value is 16KB.)

--no-auto-rehash , -A This has the same effect as --skip-auto-rehash . See the description for --auto-rehash .

--no-beep , -b Do not beep when errors occur.

--one-database , -o 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. Suppose that mysql is invoked to process this set of statements: DELETE FROM db2.t2; USE db2; DROP TABLE db1.t1; CREATE TABLE db1.t1 (i INT); USE db1; INSERT INTO t1 (i) VALUES(1); CREATE TABLE db2.t1 (j INT); If the command line is mysql --force --one-database db1, mysql handles the input as follows: The DELETE statement is executed because the default database is db1 , even though the statement names a table in a different database.

The DROP TABLE and CREATE TABLE statements are not executed because the default database is not db1 , even though the statements name a table in db1 .

The INSERT and CREATE TABLE statements are executed because the default database is db1 , even though the CREATE TABLE statement names a table in a different database.

--pager[= command ] 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 Client Commands”, discusses output paging further.

--password[= password ] , -p[ password ] The password of the MySQL account used for connecting to the server. The password value is optional. If not given, mysql prompts for one. If given, there must be no space between --password= or -p and the password following it. If no password option is specified, the default is to send no password. Specifying a password on the command line should be considered insecure. To avoid giving the password on the command line, use an option file. See Section 6.1.2.1, “End-User Guidelines for Password Security”. To explicitly specify that there is no password and that mysql should not prompt for one, use the --skip-password option.

--pipe , -W On Windows, connect to the server using a named pipe. This option applies only if the server was started with the named_pipe system variable enabled to support named-pipe connections. In addition, the user making the connection must be a member of the Windows group specified by the named_pipe_full_access_group system variable.

--protocol={TCP|SOCKET|PIPE|MEMORY} The transport protocol to use for connecting to the server. It is useful when the other connection parameters normally result in use of a protocol other than the one you want. For details on the permissible values, see Section 4.2.5, “Connection Transport Protocols”.

--quick , -q 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, mysql does not use the history file.

--raw , -r 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

, \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: % mysql mysql> SELECT CHAR(92); +----------+ | CHAR(92) | +----------+ | \ | +----------+ % mysql -s mysql> SELECT CHAR(92); CHAR(92) \\ % mysql -s -r mysql> SELECT CHAR(92); CHAR(92) \

--reconnect If the connection to the server is lost, automatically try to reconnect. A single reconnect attempt is made each time the connection is lost. To suppress reconnection behavior, use --skip-reconnect .

--safe-updates , --i-am-a-dummy , -U If this option is enabled, UPDATE and DELETE statements that do not use a key in the WHERE clause or a LIMIT clause produce an error. In addition, restrictions are placed on SELECT statements that produce (or are estimated to produce) very large result sets. If you have set this option in an option file, you can use --skip-safe-updates on the command line to override it. For more information about this option, see Using Safe-Updates Mode (--safe-updates).

--secure-auth Do not send passwords to the server in old (pre-4.1) format. This prevents connections except for servers that use the newer password format. This option is enabled by default; use --skip-secure-auth to disable it. Note Passwords that use the pre-4.1 hashing method are less secure than passwords that use the native password hashing method and should be avoided. Pre-4.1 passwords are deprecated and support for them will be removed in a future MySQL release. For account upgrade instructions, see Section 6.4.1.3, “Migrating Away from Pre-4.1 Password Hashing and the mysql_old_password Plugin”. Note This option is deprecated and will be removed in a future release. As of MySQL 5.7.5, it is always enabled and attempting to disable it produces an error.

--server-public-key-path= file_name The path name to a file in PEM format containing a client-side copy of the public key required by the server for RSA key pair-based password exchange. This option applies to clients that authenticate with the sha256_password authentication plugin. This option is ignored for accounts that do not authenticate with that plugin. It is also ignored if RSA-based password exchange is not used, as is the case when the client connects to the server using a secure connection. This option is available only if MySQL was built using OpenSSL. For information about the sha256_password plugin, see Section 6.4.1.4, “SHA-256 Pluggable Authentication”.

--shared-memory-base-name= name On Windows, the shared-memory name to use for connections made using shared memory to a local server. The default value is MYSQL . The shared-memory name is case-sensitive. This option applies only if the server was started with the shared_memory system variable enabled to support shared-memory connections.

--show-warnings Cause warnings to be shown after each statement if there are any. This option applies to interactive and batch mode.

--sigint-ignore Ignore SIGINT signals (typically the result of typing Control+C). Without this option, typing Control+C interrupts the current statement if there is one, or cancels any partial input line otherwise.

--silent , -s Silent mode. Produce less output. This option can be given multiple times to produce less and less output. 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 --raw option.

--skip-column-names , -N Do not write column names in results.

--skip-line-numbers , -L Do not write line numbers for errors. Useful when you want to compare result files that include error messages.

--socket= path , -S path For connections to localhost , the Unix socket file to use, or, on Windows, the name of the named pipe to use. On Windows, this option applies only if the server was started with the named_pipe system variable enabled to support named-pipe connections. In addition, the user making the connection must be a member of the Windows group specified by the named_pipe_full_access_group system variable.

--ssl* Options that begin with --ssl specify whether to connect to the server using SSL and indicate where to find SSL keys and certificates. See Command Options for Encrypted Connections.

--table , -t Display output in table format. This is the default for interactive use, but can be used to produce table output in batch mode.

--unbuffered , -n Flush the buffer after each query.

--user= user_name , -u user_name The user name of the MySQL account to use for connecting to the server.

--verbose , -v 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.)

--vertical , -E 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 \G .