PeterPu
发布于 2025-08-11 / 2 阅读
0
0

spring 链接mysql 默认连接池警告

No operations allowed after connection closed.). Possibly consider using a shorter maxLifetime value

springboot hikari 连接数据库总是报这个警告  修改max-lifetim不起作用

首先在mysql中执行 

SHOW VARIABLES LIKE "%timeout%";

得到结果:

坑就坑在这里了,这里查出来的wait_timeout的值显示的是28800秒,误导我以为数据库配置的wait_timeout就是28800,然而并不是,一次偶然的机会,执行了下 vim /etc/my.cnf ,

好了,问题找到了,把这项改成28800(8小时),再重启mysql


评论