Home >Database >Mysql Tutorial >MySQL client commands

MySQL client commands

WBOY
WBOYforward
2023-09-07 21:13:051209browse

MySQL 客户端命令

Let’s understand some MySQL client commands -

MySQL sends every SQL statement issued by the user to the server for execution. There is also a set of commands that mysql interprets itself.

Get the list of commands

You can find the list of these commands by typing the below mentioned commands at the prompt -

mysql> help

Output

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.

If When calling mysql with the "--binary-mode" option, assuming input is piped to mysql or loaded using the source command, all mysql commands are disabled except character set and delimiters in non-interactive mode.

Each command has a long form and a short form.

Long format command

The long format is not case-sensitive, and the short format is case-sensitive. The long form may be followed by an optional semicolon terminator, but the short form should not be followed by anything.

Short format commands

Use short format commands in multiple commands -line /* ... */ Comments are not supported. Shorthand commands work within a single line /*! ... */ version comments, /* ... */ optimizer hint comments as well. They are stored in the object definition.

The above is the detailed content of MySQL client commands. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete