目录
MySQL Shell 命令介绍
The Shell Help is organized in categories and topics. To get help for a
specific category or topic use: \? <pattern>
Shell 帮助按类别和主题进行组织。 要获得特定类别或主题的帮助,请使用:\? <pattern>
The <pattern> argument should be the name of a category or a topic.
<pattern>参数应该是一个类别或一个主题的名称。
The pattern is a filter to identify topics for which help is required, it can
use the following wildcards:
该模式是一个过滤器,用于识别需要帮助的主题,它可以使用以下通配符:
- ? matches any single character. - ? 匹配任何单个字符。
- * matches any character sequence. - * 匹配任何字符序列。
The following are the main help categories: 以下是主要的帮助类别:
- AdminAPI The AdminAPI is an API that enables configuring and managing
InnoDB Clusters, ReplicaSets, ClusterSets, among other
things.
- AdminAPI AdminAPI 是一个 API,可以配置和管理 InnoDB Clusters、ReplicaSets、ClusterSets 等。
- Shell Commands Provides details about the available built-in shell commands.
-Shell命令提供了有关可用的内置shell命令的详细信息。
- ShellAPI Contains information about the shell and util global objects
as well as the mysql module that enables executing SQL on
MySQL Servers.
- ShellAPI 包含有关 shell 和 util 全局对象以及启用在 MySQL 服务器上执行 SQL 的 mysql 模块的信息。
- SQL Syntax Entry point to retrieve syntax help on SQL statements.
- SQL Syntax 以检索SQL语句上的语法帮助。
- X DevAPI Details the mysqlx module as well as the capabilities of the
X DevAPI which enable working with MySQL as a Document Store
- X DevAPI 详细介绍 mysqlx 模块以及 X DevAPI 的功能,这些功能可以将 MySQL 作为文档存储使用
The available topics include:
可用主题包括:
- The dba global object and the classes available at the AdminAPI.
- dba全局对象和在AdminAPI中可用的类。
- The mysqlx module and the classes available at the X DevAPI.
- mysqlx模块和在XDevAPI上可用的类。
- The mysql module and the global objects and classes available at the
ShellAPI.
- mysql 模块以及 ShellAPI 中可用的全局对象和类。
- The functions and properties of the classes exposed by the APIs.
- 由api所公开的类的函数和属性。
- The available shell commands.
- 可用的shell命令。
- Any word that is part of an SQL statement.
- SQL语句中的任何单词。
- Command Line - invoking built-in shell functions without entering interactive
mode.
- 命令行 - 在不进入交互模式的情况下调用内置的 shell 函数。
SHELL COMMANDS
shell命令
The shell commands allow executing specific operations including updating the
shell configuration.
shell 命令允许执行特定操作,包括更新 shell 配置。
The following shell commands are available:
可使用以下shell命令:
- \ Start multi-line input when in SQL mode.
- \ 在SQL模式下启动多行输入。
- \connect (\c) Connects the shell to a MySQL server and assigns the
global session.
- \connect (\c) 将 shell 连接到 MySQL 服务器并分配全局会话。
- \disconnect Disconnects the global session.
- \disconnect 断开连接将断开全局会话的连接。
- \edit (\e) Launch a system editor to edit a command to be executed.
- \edit (\e) 启动系统编辑器以编辑要执行的命令。
- \exit Exits the MySQL Shell, same as \quit.
- \exit 退出MySQLShell,与\quit相同。
- \help (\?,\h) Prints help information about a specific topic.
- \help (\?,\h)打印有关特定主题的帮助信息。
- \history View and edit command line history.
- \history 查看和编辑命令行历史记录。
- \js Switches to JavaScript processing mode.
- \js 切换到JavaScript处理模式。
- \nopager Disables the current pager.
- \nopager 禁用当前的寻呼机。
- \nowarnings (\w) Don't show warnings after every statement.
- \nowarnings (\w) 不要在每个语句之后都显示警告。
- \option Allows working with the available shell options.
- \option 允许使用可用的shell选项。
- \pager (\P) Sets the current pager.
- \pager (\P) 设置当前的寻呼机。
- \py Switches to Python processing mode.
- \py 切换到Python处理模式。
- \quit (\q) Exits the MySQL Shell.
- \quit (\q) 退出MySQL shell程序。
- \reconnect Reconnects the global session.
- \reconnect 将重新连接全局会话。
- \rehash Refresh the autocompletion cache.
- \rehash 重新刷新自动完成缓存。
- \show Executes the given report with provided options and
arguments.
- \show 使用提供的选项和参数执行给定的报告。
- \source (\.) Loads and executes a script from a file.
- \source (\.) 从一个文件中加载并执行一个脚本。
- \sql Executes SQL statement or switches to SQL processing
mode when no statement is given.
- \sql 未给出语句时执行 SQL 语句或切换到 SQL 处理模式。
- \status (\s) Print information about the current global session.
- \status (\s) 打印有关当前全局会话的信息。
- \system (\!) Execute a system shell command.
- \system (\!) 执行系统shell命令。
- \use (\u) Sets the active schema.
- \use (\u) 设置活动模式。
- \warnings (\W) Show warnings after every statement.
- \warnings (\W) 在每条语句后都会显示警告。
- \watch Executes the given report with provided options and
arguments in a loop.
- \watch 在循环中使用提供的选项和参数执行给定的报告。
GLOBAL OBJECTS
The following modules and objects are ready for use when the shell starts:
当Shell启动时,可以随时使用以下模块和对象:
- dba Used for InnoDB Cluster, ReplicaSet, and ClusterSet administration.
- dba 用于InnoDB集群、复制集和集群集管理。
- mysql Support for connecting to MySQL servers using the classic MySQL
protocol.
- mysql 支持使用经典 MySQL 协议连接到 MySQL 服务器。
- mysqlx Used to work with X Protocol sessions using the MySQL X DevAPI.
- mysqlx 用来使用MySQLXDevAPI使用X协议会话。
- os Gives access to functions which allow to interact with the operating
system.
- os 允许访问允许与操作系统交互的功能。
- plugins Plugin to manage MySQL Shell plugins
-插件插件来管理MySQLShell插件
- shell Gives access to general purpose functions and properties.
- shell 允许访问通用的函数和属性。
- sys Gives access to system specific parameters.
- sys 允许访问系统特定的参数。
- util Global object that groups miscellaneous tools like upgrade checker
and JSON import.
- util 对升级检查器和 JSON 导入等各种工具进行分组的全局对象。
For additional information on these global objects use: <object>.help()
有关这些全局对象的其他信息,请使用:<object>.help()
EXAMPLES示例
\? AdminAPI
Displays information about the AdminAPI.
显示有关AdminAPI的信息。
\? \connect
Displays usage details for the \connect command.
显示\连接命令的使用详细信息。
\? checkInstanceConfiguration
Displays usage details for the dba.checkInstanceConfiguration function.
显示dba.checkInstanceConfiguration函数的使用详细信息。
\? sql syntax
Displays the main SQL help categories.
显示主要的SQL帮助类别。