本文主要向大家介绍了MySQL数据库之mysql连接的空闲时间超过8小时后 MySQL自动断开该连接解决方案 ,通过具体的内容向大家展现,希望对大家学习MySQL数据库有所帮助。
解决这个问题的办法有三种:
1. 增加 MySQL 的 wait_timeout 属性的值。
修改 /etc/mysql/my.cnf文件,在 [mysqld] 节中设置:
# Set a connection to wait 8hours in idle status.
wait_timeout =86400
相关参数,红色部分
mysql> show variables like '%timeout%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| connect_timeout | 5 |
| delayed_insert_timeout | 300 |
| innodb_lock_wait_timeout | 50 |
| interactive_timeout | 28800 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| slave_net_timeout | 3600 |
| wait_timeout | 28800 |
+--------------------------+-------+
同一时间,这两个参数只有一个起作用。到底是