参数介绍:The number of seconds the server waits for activity on an interactive connection before closing it. An interactive client is defined as a client that uses the
The number of seconds the server waits for activity on a noninteractive connection before closing it. Before MySQL 5.1.41, this timeout applies only to TCP/IP connections, not to connections made through Unix socket files, named pipes, or shared memory. On thread startup, the session
CLIENT_INTERACTIVE Permit 简单的说 interactive就是交互式的终端,例如在shell里面直接执行mysql,出现 mysql> 后就是交互式的连接。而mysql -e 'select 1' 这样的直接返回结果的方式就是非交互式的连接。 第二部分 测试2.1 继承关系Q:通过Socket连接 timeout会从哪个global timeout继承 A:由下例可见,通过socket登录,timeout 继承于global.interactive_timeout;
Q:通过TCP/IP client 连接, timeout会从哪个global timeout继承 A:由下例可见,通过TCP/IP client 连接后的wait_timeout 仍然继承于 global.interactive_timeout
2.2 起效关系Q:timeout值,对于正在运行用的语句是否起效? A:由下例可见SQL正在执行状态的等待时间不计入timeout时间
Q:wait_timeout 和 interacitve_timeout 如何相互作用。 A:只有session.wait_timeout 会起效
Q:global timeout和session timeout哪个起作用。 A:只有session timeout 会起作用。 测试1:
测试2:
第三部分 总结由以上的阶段测试可以获得以下结论。 1. 超时时间只对非活动状态的connection进行计算。 2. 超时时间指通过 session wait_timeout 起效。 3. 交互式连接的wait_timeout 继承于 global.interactive_timeout 非交互式连接的wait_timeout 继承于 global.wait_timeout 4. 继承关系和超时对 TCP/IP 和 Socket 连接均有效果 |
|