mysql操作错误server has gone away

来源:互联网 发布:广东中标数据 编辑:程序博客网 时间:2024/05/17 23:44

原因二. mysql连接超时
即某个mysql长连接很久没有新的请求发起,达到了server端的timeout,被server强行关闭。
此后再通过这个connection发起查询的时候,就会报错server has gone away
mysql> show global variables like '%timeout';
+----------------------------+----------+
| Variable_name | Value |
+----------------------------+----------+
| connect_timeout | 10 |
| delayed_insert_timeout | 300 |
| innodb_lock_wait_timeout | 50 |
| innodb_rollback_on_timeout | OFF |
| interactive_timeout | 28800 |
| lock_wait_timeout | 31536000 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| slave_net_timeout | 3600 |
| wait_timeout | 28800 |
+----------------------------+----------+
10 rows in set
wait_timeout 是28800秒,即mysql链接在无操作28800秒后被自动关闭



show global variables like '%timeout';
show global variables;
set global wait_timeout = 10; ---需要重启mysql client进程才能生效。

0 0