Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
查看超时
show global variables like 'wait_timeout';
show global variables like 'interactive_timeout';
show VARIABLES like 'max_connections'
show variables like '%timeout%'
select * from information_schema.processlist;
//设置交互式连接超时时间,例如mysql客户端
set session interactive_timeout=60;
set GLOBAL interactive_timeout=60;
//设置非交互式连接超时时间,例如jdbc
set session wait_timeout=60;
set GLOBAL wait_timeout=60;
maxWait: 10000
# 配置一个连接在池中的最小生存时间,单位是毫秒 300000
minEvictableIdleTimeMillis: 300000
maxEvictableIdleTimeMillis: 600000
# 1、关闭空闲连接的检测时间间隔;2、testWhileIdle的判断依据,单位是毫秒。默认60s 60000
timeBetweenEvictionRunsMillis: 60000
# 用来检测连接是否有效的sql,要求是一个查询语句,常用select 'x'。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用。
validationQuery: SELECT 1
# 申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
testWhileIdle: true
# 申请连接时执行validationQuery检测连接是否有效
testOnBorrow: false
# 归还连接时执行validationQuery检测连接是否有效
testOnReturn: false
# 打开PSCache,并且指定每个连接上PSCache的大小。PSCache对支持游标的数据库性能提升巨大,比如说oracle。在mysql下建议关闭。【待验证】
poolPreparedStatements: true