Mysql:mysql.exe命令行客户端

概述

  • mysql.exe可以运行在 {交互模式|非交互模式}。在交互模式下,查询结果以ascii表的形式展现;在非交互模式下,可以通过选项来是查询结果以{tab分割的文本 | xml | html |等等}展现;非交互模式是通过管道转向来实现的!
  • 如果因为查询结果过大而致使内存不足问题出现:可以通过--quick选项逐行输出模式
  • mysql.exe可以识别的命令结束分隔符:";"、\g、\G
  • ctrl+c可以取消当前的查询语句 或者 退出!
  • {source|.\}可以执行脚本文件

命令

牛X的帮助命令:{ help | \h | ?}  可以获得几乎你想要的任何东西,就是更加简洁直接的参考手册,(应该是基于index的技术构造的)

?

(\?)

Synonym for `help'.

clear

(\c)

Clear command.

connect

(\r)

Reconnect to the server. Optional arguments are db and host.

delimiter

(\d)

Set statement delimiter.

ego

(\G)

Send command to mysql server, display result vertically.

exit

(\q)

Exit mysql. Same as quit.

go

(\g)

Send command to mysql server.

help

(\h)

Display this help.

notee

(\t)

Don't write into outfile.

print

(\p)

Print current command.

prompt

(\R)

Change your mysql prompt.

quit

(\q)

Quit mysql.

rehash

(\#)

Rebuild completion hash.

source

(\.)

Execute an SQL script file. Takes a file name as an argument.

status

(\s)

Get status information from the server.

tee

(\T)

Set outfile [to_outfile]. Append everything into given outfile.

use

(\u)

Use another database. Takes database name as argument.

charset

(\C)

Switch to another charset. Might be needed for processing binlog with multi-byte charsets.

warnings

(\W)

Show warnings after every statement.

nowarning

(\w)

Don't show warnings after every statement.

 

选项

Format Config File Description Introduction Deprecated Removed
--auto-rehash auto-rehash Enable automatic rehashing      
--batch batch Don't use history file      
--character-sets-dir=name character-sets-dir Set the default character set      
--column-names column-names Write column names in results      
--column-type-info column-type-info Display result set metadata 5.1.14    
--comments comments Whether to retain or strip comments in statements sent to the server 5.1.23    
--compress compress Compress all information sent between the client and the server      
--connect_timeout=value connect_timeout The number of seconds before connection timeout      
--database=dbname database The database to use      
--debug[=debug_options] debug Write a debugging log      
--debug-check debug-check Print debugging information when the program exits 5.1.21    
--debug-info debug-info Print debugging information, memory and CPU statistics when the program exits      
--default-character-set=charset_name default-character-set Use charset_name as the default character set      
--delimiter=str delimiter Set the statement delimiter      
--execute=statement execute Execute the statement and quit      
--force force Continue even if an SQL error occurs      
--help   Display help message and exit      
--host=host_name host Connect to the MySQL server on the given host      
--html html Produce HTML output      
--ignore-spaces ignore-spaces Ignore spaces after function names      
--line-numbers line-numbers Write line numbers for errors      
--local-infile[={0|1}] local-infile Enable or disable for LOCAL capability for LOAD DATA INFILE      
--max_allowed_packet=value max_allowed_packet The maximum packet length to send to or receive from the server      
--max_join_size=value max_join_size The automatic limit for rows in a join when using --safe-updates      
--named-commands named-commands Enable named mysql commands      
--net_buffer_length=value net_buffer_length The buffer size for TCP/IP and socket communication      
--no-auto-rehash   Disable automatic rehashing      
--no-beep no-beep Do not beep when errors occur      
--no-named-commands no-named-commands Disable named mysql commands      
--no-pager no-pager Deprecated form of --skip-pager      
--no-tee no-tee Do not copy output to a file      
--one-database one-database Ignore statements except those for the default database named on the command line      
--pager[=command] pager Use the given command for paging query output      
--password[=password] password The password to use when connecting to the server      
--port=port_num port The TCP/IP port number to use for the connection      
--prompt=format_str prompt Set the prompt to the specified format      
--protocol=type protocol The connection protocol to use      
--quick quick Do not cache each query result      
--raw raw Write column values without escape conversion      
--reconnect reconnect If the connection to the server is lost, automatically try to reconnect      
--safe-updates safe-updates Allow only UPDATE and DELETE statements that specify key values      
--secure-auth secure-auth Do not send passwords to the server in old (pre-4.1.1) format      
--select_limit=value select_limit The automatic limit for SELECT statements when using --safe-updates      
--show-warnings show-warnings Show warnings after each statement if there are any      
--sigint-ignore sigint-ignore Ignore SIGINT signals (typically the result of typing Control-C)      
--silent silent Silent mode      
--skip-auto-rehash skip-auto-rehash Disable automatic rehashing      
--skip-column-names skip-column-names Do not write column names in results      
--skip-line-numbers skip-line-numbers Skip line numbers for errors      
--skip-named-commands skip-named-commands Disable named mysql commands      
--skip-pager skip-pager Disable paging      
--skip-reconnect skip-reconnect Disable reconnecting      
--socket=path socket For connections to localhost      
--ssl-ca=file_name ssl-ca The path to a file that contains a list of trusted SSL CAs      
--ssl-capath=directory_name ssl-capath The path to a directory that contains trusted SSL CA certificates in PEM format      
--ssl-cert=file_name ssl-cert The name of the SSL certificate file to use for establishing a secure connection      
--ssl-cipher=cipher_list ssl-cipher A list of allowable ciphers to use for SSL encryption      
--ssl-key=file_name ssl-key The name of the SSL key file to use for establishing a secure connection      
--ssl-verify-server-cert ssl-verify-server-cert The server's Common Name value in its certificate is verified against the host name used when connecting to the server      
--table table Display output in tabular format      
--tee=file_name tee Append a copy of output to the given file      
--unbuffered unbuffered Flush the buffer after each query      
--user=user_name user The MySQL user name to use when connecting to the server      
--verbose   Verbose mode      
--version   Display version information and exit      
--vertical vertical Print query output rows vertically (one line per column value)      
--wait wait If the connection cannot be established, wait and retry instead of aborting      
--xml xml Produce XML output      
原文地址:https://www.cnblogs.com/jinzhenshui/p/1500621.html