登录
首页 >  数据库 >  MySQL

MySQL 客户端命令

来源:tutorialspoint

时间:2023-08-29 10:47:12 365浏览 收藏

知识点掌握了,还需要不断练习才能熟练运用。下面golang学习网给大家带来一个数据库开发实战,手把手教大家学习《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 /* ... */ 不支持注释。简写命令在单行 /* 内工作! ... */ 版本注释,/*+ ... */ 优化器提示注释也是如此。它们存储在对象定义中。

今天带大家了解了的相关知识,希望对你有所帮助;关于数据库的技术知识我们会一点点深入介绍,欢迎大家关注golang学习网公众号,一起学习编程~

声明:本文转载于:tutorialspoint 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>