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斷開