MySQL 超时后处于休眠模式的连接
MySQL Connections in Sleep Mode after Timeout
我在 Centos 6 上有一个 MySQL 5.7.16 运行。我读到这两个配置变量,
interactive_timeout - interactive time out for mysql shell sessions in
seconds like mysqldump or mysql command line tools.
wait_timeout - the amount of seconds during inactivity that MySQL will
wait before it will close a connection on a non-interactive connection
in seconds.
我在我的服务器中将这两个变量设置为 120 秒,这意味着在这段时间之后,交互式(mysql shell)和非交互式(如前端应用程序)如果处于“sleep”模式,则应自动断开连接。
我观察到来自应用程序的一些会话和来自不同 IDE 的其他 TCP/IP 连接,例如 MySQL Workbench 运行 甚至在 120 秒后。有时他们会超过 200 秒。
我的配置文件中是否还需要进行其他设置?
您是否将 GLOBAL 变量设置为 120?
使用
SET GLOBAL wait_timeout = 120
已成立
SET wait_timeout= 120
请记住,仅针对新连接刷新值。
运行:
SELECT @@global.wait_timeout, @@session.wait_timeout;
检查真实值。
我在 Centos 6 上有一个 MySQL 5.7.16 运行。我读到这两个配置变量,
interactive_timeout - interactive time out for mysql shell sessions in seconds like mysqldump or mysql command line tools.
wait_timeout - the amount of seconds during inactivity that MySQL will wait before it will close a connection on a non-interactive connection in seconds.
我在我的服务器中将这两个变量设置为 120 秒,这意味着在这段时间之后,交互式(mysql shell)和非交互式(如前端应用程序)如果处于“sleep”模式,则应自动断开连接。
我观察到来自应用程序的一些会话和来自不同 IDE 的其他 TCP/IP 连接,例如 MySQL Workbench 运行 甚至在 120 秒后。有时他们会超过 200 秒。
我的配置文件中是否还需要进行其他设置?
您是否将 GLOBAL 变量设置为 120?
使用
SET GLOBAL wait_timeout = 120
已成立
SET wait_timeout= 120
请记住,仅针对新连接刷新值。
运行:
SELECT @@global.wait_timeout, @@session.wait_timeout;
检查真实值。