0

0

MYSQL入门学习之十七:MYSQL命令行内可使用的命令详细说明_MySQL

php中文网

php中文网

发布时间:2016-06-01 13:37:32

|

1076人浏览过

|

来源于php中文网

原创

bitsCN.com

mysql入门学习之十七:mysql命令行内可使用的命令详细说明

 

相关链接:

MYSQL入门学习之一:基本操作

http:///database/201212/173868.html

MYSQL入门学习之二:使用正则表达式搜索

http:///database/201212/173869.html

MYSQL入门学习之三:全文本搜索

http:///database/201212/173873.html

MYSQL入门学习之四:MYSQL的数据类型

http:///database/201212/175536.html

MYSQL入门学习之五:MYSQL的字符集

http:///database/201212/175541.html

MYSQL入门学习之六:MYSQL的运算符

http:///database/201212/175862.html

MYSQL入门学习之七:MYSQL常用函数

http:///database/201212/175864.html

MYSQL入门学习之八:数据库及表的基本操作

http:///database/201212/175867.html

MYSQL入门学习之九:索引的简单操作

http:///database/201212/176772.html

MYSQL入门学习之十:视图的基本操作

http:///database/201212/176775.html

MYSQL入门学习之十一:触发器的基本操作

http:///database/201212/176781.html

MYSQL入门学习之十二:存储过程的基本操作

http:///database/201212/177380.html

MYSQL入门学习之十三:自定义函数的基本操作

http:///database/201212/177382.html

MYSQL入门学习之十四:游标的基本操作

http:///database/201212/177384.html

MYSQL入门学习之十五:事务处理的基本操作

http:///database/201212/177385.html

MYSQL入门学习之十六:MYSQL命令参数详解

http:///database/201212/178079.html

 

在MYSQL命令行中,有一些非常实用的小命令可以使用。

进行MYSQL命令行后,输入/h,可查看MYSQL命令行支持的小命令及对应的功能说明:

[sql]

mysql> /h  

  

  

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 Network 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 command.  

connect   (/r) Reconnect to the server. Optional arguments are db and host.  

delimiter (/d) Set statement delimiter. NOTE: Takes the rest of the line as new 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.  

  

  

For server side help, type 'help contents'  

这段输出主要包含两部分信息:

第一部分为MYSQL客户端相关的小命令,其对应的中文翻译如下:

 

? (/?) 显示帮助信息。与/h的功能相同

clear (/c) 不执行当前正在输入的命令。若/c前已包含命令分隔符,则命令分隔符之前的部分仍然执行。

connect (/r) 重新连接到服务器。该命令有两个参数:数据库名和服务器主机名,其中主机名可省略。

delimiter (/d) 修改命令分隔符

ego (/G) 将命令的结果以垂直的形式显示

exit (/q) 退出

go (/g) 向服务器发送命令。在语句的最后使用,可替代命令分隔符。

help (/h) 显示帮助信息。与/?的功能相同

notee (/t) 不要写入OUTFILE

print (/p) 显示当前执行的命令

prompt (/R) 修改MYSQL的提示符

quit (/q) 退出

rehash (/#)

source (/.) 执行参数文件中的SQL脚本

status (/s) 获取服务器端状态

tee (/T) 指定一个输出文件,将命令行中的所有操作及结果记入此文件

use (/u) 转换当前使用的数据库

charset (/C) 转换当前connection及client的字符集

warnings (/W) 显示警告信息

nowarning (/w) 不显示警告信息 示例:

[sql] 

mysql> select count(*) from newname/c  

mysql> select count(*) from newname;/c  

+----------+  

| count(*) |  

+----------+  

|      159 |  

+----------+  

  

mysql>/R this is mysql5 >  

PROMPT set to 'this is mysql5 >'  

this is mysql5 >/. h:/select.sql  

+----------+  

| count(*) |  

+----------+  

|      159 |  

+----------+  

  

this is mysql5 >/s  

--------------  

mysql  Ver 14.14 Distrib 5.1.28-rc, for Win32 (ia32)  

  

Connection id:          25  

Current database:       test  

Current user:           root@localhost  

SSL:                    Not in use  

Using delimiter:        ;  

Server version:         5.1.28-rc-community MySQL Community Server (GPL)  

Protocol version:       10  

Connection:             localhost via TCP/IP  

Server characterset:    latin1  

Db     characterset:    latin1  

Client characterset:    gbk  

Conn.  characterset:    gbk  

TCP port:               3306  

Uptime:                 1 hour 29 min 31 sec  

  

Threads: 1  Questions: 55  Slow queries: 0  Opens: 24  Flush tables: 1  Open tables: 5  Queries per second avg: 0.10  

--------------  

  

this is mysql5 >/T h:/a.txt  

Logging to file 'h:/a.txt'  

  

this is mysql5 >/q  

Bye  

第二部分为查看MYSQL服务端相关信息的命令,使用help contents可以查看其用法:

[sql] 

mysql> help contents  

You asked for help about help category: "Contents"  

For more information, type 'help ', where is one of the following  

categories:  

   Account Management  

   Administration  

   Data Definition  

   Data Manipulation  

   Data Types  

   Functions  

   Functions and Modifiers for Use with GROUP BY  

   Geographic Features  

   Language Structure  

   Plugins  

   Storage Engines  

   Stored Routines  

   Table Maintenance  

   Transactions  

   Triggers  

对于某些help命令的结果,仍然可以使用help进行进一步的查看。如help Data Types的结果如下:

[sql] 

mysql> help Data Types  

You asked for help about help category: "Data Types"  

For more information, type 'help ', where is one of the following  

topics:  

   AUTO_INCREMENT  

   BIGINT  

   BINARY  

   BIT  

   BLOB  

   BLOB DATA TYPE  

   BOOLEAN  

   CHAR  

   CHAR BYTE  

   DATE  

   DATETIME  

   DEC  

   DECIMAL  

   DOUBLE  

   DOUBLE PRECISION  

   ENUM  

   FLOAT  

   INT  

   INTEGER  

   LONGBLOB  

   LONGTEXT  

   MEDIUMBLOB  

   MEDIUMINT  

   MEDIUMTEXT  

   SET DATA TYPE  

   SMALLINT  

   TEXT  

   TIME  

   TIMESTAMP  

   TINYBLOB  

   TINYINT  

   TINYTEXT  

   VARBINARY  

   VARCHAR  

   YEAR DATA TYPE  

仍然可以使用help INT,查看INT数据类型的详细信息:

[sql] 

mysql> help INT  

Name: 'INT'  

Description:  

INT[(M)] [UNSIGNED] [ZEROFILL]  

  

A normal-size integer. The signed range is -2147483648 to 2147483647.  

The unsigned range is 0 to 4294967295.  

  

URL: http://dev.mysql.com/doc/refman/5.1/en/numeric-type-overview.html  

由结果可以查看INT类型的用法,以及INT数据类型能表示的数据范围。

 

bitsCN.com

相关专题

更多
虚拟号码教程汇总
虚拟号码教程汇总

本专题整合了虚拟号码接收验证码相关教程,阅读下面的文章了解更多详细操作。

29

2025.12.25

错误代码dns_probe_possible
错误代码dns_probe_possible

本专题整合了电脑无法打开网页显示错误代码dns_probe_possible解决方法,阅读专题下面的文章了解更多处理方案。

20

2025.12.25

网页undefined啥意思
网页undefined啥意思

本专题整合了undefined相关内容,阅读下面的文章了解更多详细内容。后续继续更新。

37

2025.12.25

word转换成ppt教程大全
word转换成ppt教程大全

本专题整合了word转换成ppt教程,阅读专题下面的文章了解更多详细操作。

6

2025.12.25

msvcp140.dll丢失相关教程
msvcp140.dll丢失相关教程

本专题整合了msvcp140.dll丢失相关解决方法,阅读专题下面的文章了解更多详细操作。

2

2025.12.25

笔记本电脑卡反应很慢处理方法汇总
笔记本电脑卡反应很慢处理方法汇总

本专题整合了笔记本电脑卡反应慢解决方法,阅读专题下面的文章了解更多详细内容。

6

2025.12.25

微信调黑色模式教程
微信调黑色模式教程

本专题整合了微信调黑色模式教程,阅读下面的文章了解更多详细内容。

5

2025.12.25

ps入门教程
ps入门教程

本专题整合了ps相关教程,阅读下面的文章了解更多详细内容。

4

2025.12.25

苹果官网入口直接访问
苹果官网入口直接访问

苹果官网直接访问入口是https://www.apple.com/cn/,该页面具备0.8秒首屏渲染、HTTP/3与Brotli加速、WebP+AVIF双格式图片、免登录浏览全参数等特性。本专题为大家提供相关的文章、下载、课程内容,供大家免费下载体验。

218

2025.12.24

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
动力节点mysql基础视频教程
动力节点mysql基础视频教程

共86课时 | 18万人学习

CSS3 教程
CSS3 教程

共18课时 | 4万人学习

Bootstrap 5教程
Bootstrap 5教程

共46课时 | 2.6万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号