Skip to content

Server端帮助文档

xiaoboluo768 edited this page Jun 7, 2020 · 2 revisions
  • 使用MySQL 命令行客户端查询帮助信息,可以使用help语法,help语法支持三种层级的查询:帮助类别查询、帮助主题查询、帮助信息查询,如下:

  • 帮助类别:帮助主题信息保存在表mysql.help_category中,直接查询该表与使用语句 help 'contents'; 效果类似,都可以返回当前Server中所有的帮助类别
root@localhost : sys 02:23:38> HELP 'contents'
You asked for help about help category: "Contents"
For more information, type 'help <item>', where <item> is one of the following
categories:
   Account Management
   Administration
   Compound Statements
   Data Definition
   Data Manipulation
   Data Types
   Functions
   Functions and Modifiers for Use with GROUP BY
   Geographic Features
   Help Metadata
   Language Structure
   Plugins
   Procedures
   Storage Engines
   Table Maintenance
   Transactions
   User-Defined Functions
   Utility
  • 帮助主题:使用任意一个HELP 'contents' 语句查询返回的帮助类别列表中的类别名称进行查询,返回指定帮助列表中的帮助主题列表
root@localhost : sys 03:01:21> HELP 'data types'
You asked for help about help category: "Data Types"
For more information, type 'help <item>', where <item> 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
  • 帮助字符串信息:使用任意一个帮助主题,返回指定帮助主题的具体帮助信息
root@localhost : sys 03:03:37> help AUTO_INCREMENT;
Name: 'AUTO_INCREMENT'
Description:
The AUTO_INCREMENT attribute can be used to generate a unique identity
for new rows:

URL: http://dev.mysql.com/doc/refman/5.7/en/example-auto-increment.html

Examples:
CREATE TABLE animals (
     id MEDIUMINT NOT NULL AUTO_INCREMENT,
     name CHAR(30) NOT NULL,
     PRIMARY KEY (id)
);

INSERT INTO animals (name) VALUES
    ('dog'),('cat'),('penguin'),
    ('lax'),('whale'),('ostrich');

SELECT * FROM animals;
  • PS:
  • HELP语句中给定的搜索关键字不区分大小写
  • 搜索关键字可以包含通配符%和_,效果与LIKE运算符执行的模式匹配操作含义相同。例如:HELP 'rep%'返回以rep开头的主题列表
  • 如果帮助类别字符串、帮助主题字符串包含多个字符的,则可以使用引号引起来,也可以不使用引号,为避免歧义,最好使用引号引起来

  • 搜索结果集通常包含如下几种情况:
  • 搜索关键字不存在,则返回空集,提示找不到匹配项
root@localhost : sys 03:19:08> help 'xx'

Nothing found
Please try to run 'help contents' for a list of all accessible topics
  • 搜索结果集中包含单行数据,会直接返回帮助主题对应的具体的帮助信息,包含三个字段的信息
root@localhost : sys 03:21:30> HELP 'replace'
Name: 'REPLACE'   # 这里是第一列列名,表示帮助主题名称
Description:  # 这里是第二列列名,表示帮助主题的一些描述信息,例如:帮助语法信息,以及一些需要注意的事项描述等
Syntax:
REPLACE [LOW_PRIORITY | DELAYED]
    [INTO] tbl_name
    [PARTITION (partition_name [, partition_name] ...)]
    [(col_name [, col_name] ...)]
    {VALUES | VALUE} (value_list) [, (value_list)] ...
......
example:这里是第三列列名,表示帮助主题的一些用法示例信息,当然,可能很多主题的示例信息没有该列,会直接给定一个URL提示自行查看链接
url:该列是第四列列名,有些帮助信息里可能没有这个列
  • 搜索结果集中包含多行数据的,只会返回一个帮助主题列表(或者帮助类别列表)
root@localhost : sys 03:22:30> HELP 'status'
Many help items for your request exist.
To make a more specific request, please type 'help <item>',
where <item> is one of the following
topics:  # 返回一个帮助主题列表
   FLUSH
   SHOW
   SHOW ENGINE
   SHOW FUNCTION STATUS
   SHOW MASTER STATUS
   SHOW PROCEDURE STATUS
   SHOW SLAVE STATUS
   SHOW STATUS
   SHOW TABLE STATUS

root@localhost : sys 03:30:45> HELP 'functions';
You asked for help about help category: "Functions"
For more information, type 'help <item>', where <item> is one of the following
categories:  # 返回一个帮助类别列表
   Bit Functions
   Comparison operators
   Control flow functions
   Date and Time Functions
   Encryption Functions
   Information Functions
   Logical operators
   Miscellaneous Functions
   Numeric Functions
   String Functions

上一篇:help_topic表 |下一篇:Client 端帮助文档

Clone this wiki locally