MySQL command line parameters full version
The MySQL tutorial supports the following options:
---help,-?
Displays a help message and exits.
--batch,-b
Prints the results, using the TAB key as the column separator, and each row occupies a new row. With this option, MySQL does not use history files.
--character-sets-dir=path
The installation directory for the character set.
--compress,-c
Compresses all information sent between the client and the server, if both support compression.
---database=db_name,-d db_name
The database tutorial to use. is primarily useful in the options file.
---debug[=debug_options],-# [debug_options]
Write debug Log. The debug_options string is usually ' d:t:o,file_name '. The default is ' D:t:o,/tmp/mysql.trace '.
---debug-info,-t
Output part of debug information when the program exits.
--default-character-set=charset
Use Charsetas as the default character set.
--execute=statement, E-statement
Executes the statement and exits. The default output format is the same as that produced with--batch.
--force,-f
Continue even if a SQL error occurs.
--host=host_name,-h host_name
Connect to a MySQL server on a given host.
--html,-h
produces HTML output.
--ignore-space,-i
Ignore the space after the function name
--LOCAL-INFILE[={0|1}]
Enable or disable local functionality for the load DATA infile. No value, this option enables local. You can also use--local-infile=0 or--local-infile=1 to explicitly disable or enable local. Enabling local does not take effect if the server does not support it.
--named-commands,-g
The named command is enabled. Allows long format commands and short format * commands. For example, both quit and Q are recognized.
--no-auto-rehash,-a
The hash operation is not automatically rerun. This option allows MySQL to start faster, but if you want to complete the table and column name, you must issue the rehash command.
--no-beep,-b
Do not beep when an error occurs.
--no-named-commands,-g
The named command is disabled. Use only the * form, or a command that ends with a semicolon (';') only with the beginning of the line. For MySQL 3.23.22, this option is enabled by default when MySQL starts. However, even with this option, the long Format command still works from line 1th.
--no-pager
Do not use the pager to display query output.
--no-tee
Do not copy the output to a file.
·
--one--database,-o
Ignores statements except for the default database named in the command line. You can help skip updates to other databases in the binary log.
--pager[=command]
Paging query output using the given command. If the command is deleted, the default pager is the value of the pager environment variable. Legal pagers are less, more, cat [>filename] and so on. This option works only in UNIX. Cannot work in batch mode
--password[=password],-p[password]
The password to use when connecting to the server. If you use the Short option form (-p), there is no space between the option and the password. If you do not have a password value after the--password or P option on the command line, you are prompted to enter a password. The password should be omitted from the sysv-based UNIX system because the password can be displayed in the output of the PS tutorial.
--port=port_num,-p Port_num
The TCP/IP port number to use for the connection.
--prompt=format_str
Sets the prompt to the specified format. Default is mysql>.
--protocol={tcp | SOCKET | PIPE | MEMORY}
The connection agreement used.
--quick,-q
The results of each query are not cached and each row is printed in the order in which they are received. If the output is suspended, the server slows down. With this option, MySQL does not use historical files.
--raw,-r
Writes the value of a column without escaping the conversion. Usually combined with the--batch option.
--reconnect
If the connection to the server is disconnected, an automatic attempt to reconnect is attempted. Try reconnecting once each connection is disconnected. To disable reconnection, use--skip-reconnect.
--safe-updates,--i-am-a-dummy,-u
Allow only those update and DELETE statements that use key values to specify the row to take effect. If this option is already set in the options file, you can overwrite it with the--safe-updates in the command line.
--secure-auth
Do not send passwords to old (pre-4.1.1)-formatted servers. This prevents connections to servers that do not use the new password format.
--show-warnings
If a warning is displayed after each statement. This option applies to interactive and batch mode.
--sigint-ignore
Ignore the SIGINT symbol (generally the result of control-c).
--silent,-s
Silent mode. produces less output. You can use this option more than once to produce less output.
--skip-column-names,-n
The column name is not written in the result.
--skip-line-numbers,-l
The line number is not written in the error message. Useful when you want to compare results files that include error messages.
--socket=path,-s Path
The socket file to use for the connection.
--tables,-t
Displays output in tabular format. This is the default setting for interactive applications, but can be used to generate table output in batch mode.
--tee=file_name
Adds an output copy to the given file. This option does not work in batch mode.
--unbuffered,-n
Flushes the cache after each query.
--user=user_name,-u user_name
The user name that MySQL uses when connecting to the server.
--verbose,-v
Verbose mode. produce more output. You can use this option multiple times to produce more output. (for example,-v-v-V can even produce table output formats in batch mode).
--version,-v
Displays version information and exits.
--vertical,-e
The row that outputs the query output vertically. Without this option, you can use the end of G to specify the vertical output of a single statement.
--wait,-w
If a connection cannot be established, wait and try instead of giving up.
--xml,-x
produces the XML output.
You can also use the--var_name=value option to set the following variables:
Connect_timeout
The number of seconds before the connection times out. (The default value is 0).
Max_allowed_packet
The maximum packet length sent or received from the server. (The default value is 16MB).
Max_join_size
Automatic restrictions on the rows in a join when using--safe-updates. (The default value is 1,000,000).
Net_buffer_length
TCP/IP and socket communication buffer sizes. (The default value is 16KB).
Select_limit
Automatic restrictions for SELECT statements when using--safe-updates. (The default value is 1,000).
You can also use the--set-variable=var_name=value or-o var_name=value syntax to set variables. I am not in favour of using [i] this syntax [/i].