查看的语句
show global variables like "%timeout%";
结果:
+-----------------------------+----------+
| Variable_name | Value |
+-----------------------------+----------+
| connect_timeout | 60 |
| delayed_insert_timeout | 300 |
| innodb_flush_log_at_timeout | 1 |
| innodb_lock_wait_timeout | 50 |
| innodb_rollback_on_timeout | OFF |
| interactive_timeout | 28800 |
| lock_wait_timeout | 31536000 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| rpl_stop_slave_timeout | 31536000 |
| slave_net_timeout | 3600 |
| wait_timeout | 100 |
+-----------------------------+----------+
修改的语句:
Set global connect_timeout=100;
处理超时链接时批量杀死进程:
--查看进程数量
SHOW PROCESSLIST;
show variables like '%timeout%';
-- 批量处理超时链接
SELECT concat('KILL ',id,';') FROM information_schema.processlist WHERE user='sxzz';
通过生成的kill语句执行杀死进程。
例如:
KILL 3104;