时间:2021-07-01 10:21:17 帮助过:209人阅读
mysql修改wait_timeout
mysql mysql> show global variables like 'wait_timeout';
其默认值为8小时
mysql的一个connection空闲时间超过8小时,mysql会自动断开该连接。
1.修改配置 vi /etc/my.cnf [mysqld] wait_timeout=10 # /etc/init.d/mysql restart 2.直接用sql命令行修改 mysql> set global wait_timeout=10; mysql> show global variables like 'wait_timeout'; +----------------------------+-------+ | Variable_name | Value | +----------------------------+-------+ | wait_timeout | 10 | +----------------------------+-------+ show variables like '%time%'; timeBetweenEvictionRunsMillis = 20000 #dbcp每2000秒进行一次connection的检 minEvictableIdleTimeMillis = 28700 #每次检验中将超过28700秒处于空闲的connection断开