首頁  >  文章  >  資料庫  >  MySQL 用戶端指令

MySQL 用戶端指令

WBOY
WBOY轉載
2023-09-07 21:13:051177瀏覽

MySQL 客户端命令

讓我們了解一些 MySQL 用戶端指令 -

MySQL 會將使用者發出的每個 SQL 語句傳送到伺服器以便執行。還有一組 mysql 自己解釋的指令。

取得命令清單

可以透過在提示符號下鍵入下面提到的命令來找到這些命令的清單-

mysql> help

輸出

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.
connect   (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter.
edit      (\e) Edit command with $EDITOR.
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.
nopager   () Disable pager, print to stdout.
notee     (\t) Don't write into outfile.
pager     (\P) Set PAGER [to_pager]. Print the query results via PAGER.
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.
system    (\!) Execute a system shell command.
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.

如果使用「--binary-mode」選項呼叫mysql,則假定輸入透過管道傳送到mysql 或使用source 指令加載,則除了非互動模式下的字元集和分隔符號外,所有mysql 指令都將被停用。

每個指令都有長格式和短格式。

長格式指令

長格式不區分大小寫,短格式區分大小寫。長格式後面可以跟一個可選的分號終止符,但短格式後面不應跟任何內容。

短格式指令

在多個指令中使用短格式指令-line /* ... */ 不支援註解。簡寫指令在單行 /* 內工作! ... */ 版本註釋,/* ... */ 優化器提示註釋也是如此。它們儲存在物件定義中。

以上是MySQL 用戶端指令的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:tutorialspoint.com。如有侵權,請聯絡admin@php.cn刪除