MySQL Variables completion_type 数据库 参数变量解释及正确配置使用

本站中文解释

MySQL的 completion_type 参数是 Server System Variables 系统变量中的一项。主要用于SQL语句Tab补全,它指示MySQL客户端库如何处理Tab补全输入请求。它有如下三种可选值:NO_CHAIN,CHAIN,RELEASE。

NO_CHAIN:表示客户端不应该使用被动操作探索历史性输入,而仅仅完成当前输入过程。

CHAIN:表示客户端应该尝试检索此前已输入过的SQL子句,当全部标识符提供时可能提示,可以实现完全历史性记忆。

RELEASE:跟NO_CHAIN配置有些类似,再次输入时不会显示历史性的输入,但不会再检索输入的句子,即不会跟踪字符输入,而是等待下一个语句。

设置completion_type参数的方法如下:

1. 使用SET命令:
SET completion_type=No_Chain? OR SET completion_type=’No_Chain’;
2. 使用命令行初始化程序:
mysql> SET GLOBAL completion_type=No_Chain;
3. 通过运行MySQL语句:
mysql> SET GLOBAL completion_type=No_Chain;
4. 修改配置文件:
在my.cnf配置文件中添加如下行: completion_type=No_Chain,然后重启MySQL Server。
5. 使用MySQL Workbench:
MySQL Workbench可以通过图形界面轻松设置服务器变量,操作步骤如下:
1. 运行MySQL Workbench,从菜单栏进入”SQL实时会话”,或者右键单击你的服务器,打开新的SQL实时会话;
2. 运行如下SQL语句: SET GLOBAL completion_type=No_Chain;
3. 保存变量,并重新启动MySQL服务器,使设置生效。

官方英文解释

completion_type

Command-Line Format --completion-type=#
System Variable completion_type
Scope Global, Session
Dynamic Yes
Type Enumeration
Default Value NO_CHAIN
Valid Values

NO_CHAIN

CHAIN

RELEASE

0

1

2

The transaction completion type. This variable can take the
values shown in the following table. The variable can be
assigned using either the name values or corresponding integer
values.

Value Description
NO_CHAIN (or 0) COMMIT and
ROLLBACK
are unaffected. This is the default value.
CHAIN (or 1) COMMIT and
ROLLBACK
are equivalent to COMMIT AND CHAIN
and ROLLBACK AND CHAIN, respectively.
(A new transaction starts immediately with the same
isolation level as the just-terminated transaction.)
RELEASE (or 2) COMMIT and
ROLLBACK
are equivalent to COMMIT RELEASE and
ROLLBACK RELEASE, respectively. (The
server disconnects after terminating the transaction.)

completion_type affects
transactions that begin with
START
TRANSACTION
or
BEGIN and
end with COMMIT or
ROLLBACK. It
does not apply to implicit commits resulting from execution of
the statements listed in Section 13.3.3, “Statements That Cause an Implicit Commit”. It
also does not apply for
XA
COMMIT
,
XA
ROLLBACK
, or when
autocommit=1.


数据运维技术 » MySQL Variables completion_type 数据库 参数变量解释及正确配置使用