Home  >  Article  >  php教程  >  MySQL command line parameters full version

MySQL command line parameters full version

高洛峰
高洛峰Original
2016-12-14 10:29:181075browse

---help,-?
Show help message and exit.


--batch,-B
Print the results, use tab as the column separator, and each line occupies a new line. Using this option, mysql does not use history files.


--character-sets -dir=path
The installation directory of character sets.


--compress, -C
Compress all information sent between client and server (if both support compression).


---database=db_name,-D db_name
The database tutorial to use. Mainly useful in options files.


---debug[=debug_options], -# [debug_options]
Write debug logs. The debug_options string is usually 'd:t:o,file_name'. The default is 'd:t:o,/tmp/mysql.trace'.


---debug-info, -T
Output some debugging information when the program exits.


--default-character-set=charset
Use charsetas as the default character set.


--execute=statement, -e statement
Execute the statement and exit. 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 the MySQL server on the given host.


--html,-H
Produces HTML output.


--ignore-space,-i
Ignore spaces after function names


--local-infile[={0|1}]
Enable or disable LOCAL function for LOAD DATA INFILE. Without a value, this option enables LOCAL. You can also use --local-infile=0 or --local-infile=1 to explicitly disable or enable LOCAL. If the server does not support it, enabling LOCAL will not take effect.


--named-commands, -G
Named commands are enabled. Long form commands and short form * commands are allowed. For example, quit and q are both recognized.


--no-auto-rehash,-A
Do not automatically rehash. This option makes MySQL start faster, but if you want complete table and column names, you must issue the rehash command.


--no-beep,-b
Don’t sound the alarm when an error occurs.


--no-named-commands, -g
Named commands are disabled. Use only the * form, or only use commands whose names are terminated with a semicolon (';') at 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 form command still works from line 1.


--no-pager
Do not use a pager to display query output.


--no-tee
Do not copy the output to a file.
·
--one--database,-O
Ignore statements other than the default database named on the command line. Can help skip updates to other databases in the binary log.

--pager[=command]
Use the given command to page the query output. If this command is removed, the default pager is the value of the PAGER environment variable. Legal pagers are less, more, cat [>filename], etc. This option only works in Unix. Cannot work in batch mode


--password[=password], -p[password]
The password to use when connecting to the server. If the short option form (-p) is used, there must be no spaces between the option and password. If there is no password value after the --password or -p option on the command line, you are prompted for a password. The password should be omitted on SysV-based UNIX systems, as the password can be shown in the output of the ps tutorial.


--port=port_num,-P port_num
The TCP/IP port number used for connection.


--prompt=format_str
Set the prompt to the specified format. The default is mysql>.


--protocol={TCP | SOCKET | PIPE | MEMORY}
The connection protocol used.


--quick, -q
Do not cache the results of each query and print each line in the order received. If output is hung, the server will slow down. With this option, mysql does not use history files.


--raw, -r
Write the value of the column without escaping the conversion. Usually used in conjunction with the --batch option.


--reconnect
If the connection to the server is disconnected, automatically try to reconnect. Each time the connection is disconnected, a reconnection attempt is made. To disable reconnection, use --skip-reconnect.


--safe-updates, --i-am-a-dummy, -U
Only allow UPDATE and DELETE statements that use key values ​​to specify rows. If this option has been set in the options file, it can be overridden with --safe-updates on the command line.


--secure-auth
Do not send passwords to servers in old (pre-4.1.1) format. This prevents connections from servers that do not use the new password format.


--show-warnings
Display if there are warnings after each statement. This option is available in both interactive and batch modes.


--sigint-ignore
Ignore the SIGINT symbol (usually the result of Control-C).


--silent,-s
Silent mode. Produce less output. This option can be used multiple times to produce less output.


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


--skip-line-numbers, -L
Do not write line numbers in error messages. Useful when you want to compare result files including error messages.


--socket=path,-S path
The socket file used for connection.


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


--tee=file_name
Appends a copy of the output to the given file. This option does not work in batch mode.


--unbuffered, -n
Refresh the cache area after each query.


--user=user_name,-u user_name
The user name used by MySQL when connecting to the server.


--verbose, -v
Verbose mode. Produce more output. This option can be used multiple times to produce more output. (For example, -v -v -v can produce table output format even in batch mode).

--version,-V
Display version information and exit.


--vertical,-E
Output the rows of query output vertically. Without this option, you can use the G ending to specify vertical output for a single statement.


--wait, -w
If the connection cannot be established, wait and try again instead of giving up.


--xml,-X
Produces 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
Maximum packet length sent or received from the server. (Default value is 16MB).

max_join_size
Automatic limit of rows in a join when --safe-updates is used. (The default value is 1,000,000).

net_buffer_length
TCP/IP and socket communication buffer size. (The default value is 16KB).

select_limit
Automatic limit for SELECT statements when --safe-updates is used. (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. The use of [i]this syntax[/i] is deprecated.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn