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

本站中文解释

Offline_mode用于设置MySQL服务器是否处于离线模式。如果将此变量设置为ON,则MySQL服务器将不会接受任何来自客户端的连接。这在更新MySQL服务器或系统需要重新启动时很有用,以避免客户端的查询中断。

要设置offline_mode,请使用以下命令,替换ON和OFF为您想要的状态:

SET GLOBAL offline_mode=ON;

或者

SET GLOBAL offline_mode=OFF;

官方英文解释

offline_mode

Command-Line Format --offline-mode[={OFF|ON}]
System Variable offline_mode
Scope Global
Dynamic Yes
Type Boolean
Default Value OFF

Whether the server is in offline mode, which
has these characteristics:

  • Connected client users who do not have the
    SUPER privilege are
    disconnected on the next request, with an appropriate
    error. Disconnection includes terminating running
    statements and releasing locks. Such clients also cannot
    initiate new connections, and receive an appropriate
    error.

  • Connected client users who have the
    SUPER privilege are not
    disconnected, and can initiate new connections to manage
    the server.

  • Replica threads are permitted to keep applying data to the
    server.

Only users who have the SUPER
privilege can control offline mode. To put a server in offline
mode, change the value of the
offline_mode system variable
from OFF to ON. To
resume normal operations, change
offline_mode from
ON to OFF. In offline
mode, clients that are refused access receive an
ER_SERVER_OFFLINE_MODE error.


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