Documentation Home
MySQL 8.4 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 39.8Mb
PDF (A4) - 39.9Mb
Man Pages (TGZ) - 257.9Kb
Man Pages (Zip) - 364.9Kb
Info (Gzip) - 4.0Mb
Info (Zip) - 4.0Mb


MySQL 8.4 Reference Manual  /  ...  /  mysql Client Server-Side Help

6.5.1.4 从文本文件执行 SQL 语句

mysql> help search_string

如果您为 help 命令提供了参数,mysql 将其作为搜索字符串来访问来自 MySQL 参考手册的服务器端帮助。该命令的正常运行需要在 mysql 数据库中初始化帮助表格,以包含帮助主题信息(请参阅第 7.1.17 节,“服务器端帮助支持”)。

如果搜索字符串没有匹配项,搜索将失败:

mysql> help me

Nothing found
Please try to run 'help contents' for a list of all accessible topics

使用 help contents 查看帮助类别列表:

mysql> 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
   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

如果搜索字符串匹配多个项目,mysql 显示一个匹配主题的列表:

mysql> help logs
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:
   SHOW
   SHOW BINARY LOGS
   SHOW ENGINE
   SHOW LOGS

使用一个主题作为搜索字符串来查看该主题的帮助条目:

mysql> help show binary logs
Name: 'SHOW BINARY LOGS'
Description:
Syntax:
SHOW BINARY LOGS

Lists the binary log files on the server. This statement is used as
part of the procedure described in [purge-binary-logs], that shows how
to determine which logs can be purged.
mysql> SHOW BINARY LOGS;
+---------------+-----------+-----------+
| Log_name      | File_size | Encrypted |
+---------------+-----------+-----------+
| binlog.000015 |    724935 | Yes       |
| binlog.000016 |    733481 | Yes       |
+---------------+-----------+-----------+

搜索字符串可以包含通配符 %_。这些具有与用于执行通过 LIKE 运算符的模式匹配操作相同的含义。例如,HELP rep% 返回一个以 rep 开头的主题列表:

mysql> HELP rep%
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:
   REPAIR TABLE
   REPEAT FUNCTION
   REPEAT LOOP
   REPLACE
   REPLACE FUNCTION