环境
Mysql版本:8.0
操作系统:Centos 7
操作
编辑mysql的配置文件,位置:/etc/my.cnf
命令
vim /etc/my.cnf
添加以下设置
时间单位是秒,2592000秒=30天,默认8小时
wait_timeout=2592000
interactive_timeout=2592000
重启mysql服务
systemctl restart mysqld
如果是docker运行的mysql容器
docker restart mysql_name
查看
show variables like '%timeout%';