MySQL 的简要帮助
登录 MySQL 后,打一个问号即可得到简明的帮助。这里在系统的简明帮助后补充一些个人体会或故事。文中打三个问号的,表示还不会用。
mysql> ?
For information about MySQL products and services, visit:
http://www.mysql.com/
For developer information, including the MySQL Reference Manual, visit:
http://dev.mysql.com/
To buy MySQL Enterprise support, training, or other products, visit:
https://shop.mysql.com/
List of all MySQL commands:
Note that all text commands must be first on line and end with ';'
? (\?) Synonym for `help'.
clear (\c) Clear the current input statement. //经过鄙人的试验,这个命令似乎没有作用,OS 是 Windows 7
connect (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter. //所谓 delimiter,就是语句结束符号,如 Java 中的分号,mysql 中默认的 delimiter 也是分号,可以通过 delimiter + {char or string} 来改变结束符号,这主要用在写存储过程时,需要把分号换成别的符号。
ego (\G) Send command to mysql server, display result vertically. //???
exit (\q) Exit mysql. Same as quit. // 和按 Ctrl + C 一个效果
go (\g) Send command to mysql server. //???
help (\h) Display this help. //和问号一个意思
notee (\t) Don't write into outfile. //这个命令是关闭 tee 的,具体要参看本页的 tee 命令
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. //执行一个 SQL 脚本文件,命令后跟 SQL 脚本文件路径。如 source /home/iridium/sql/hello.sql
status (\s) Get status information from the server. //查看服务器信息,很好,包含数据库版本号,字符集等等。
tee (\T) Set outfile [to_outfile]. Append everything into given outfile. //将输出记录某文件,如 tee d:\hello.txt,会把所有的输出记录到 d:\hello.txt 里,通过 notee 可以关闭输出到文件。
use (\u) Use another database. Takes database name as argument. //使用某个数据库,本命令后跟数据库名称。数据库名称可通过 show databases 获得。
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. //???
For server side help, type 'help contents'