source sql文件的时候,报错如下:
ERROR 2006 (HY000): MySQL server has gone away
经查阅导致该error的原因很多,具体分析了我的问题是语句太长了,修改max_allowed_packet的值:
mysql> show global variables like 'max_allowed_packet';
+--------------------+---------+
| Variable_name | Value |
+--------------------+---------+
| max_allowed_packet | 4194304 | // 原来的字长
+--------------------+---------+
1 row in set (0.00 sec)
更改:
mysql> set global max_allowed_packet=1024*1024*16;
mysql> show global variables like 'max_allowed_packet';
+--------------------+----------+
| Variable_name | Value |
+--------------------+----------+
| max_allowed_packet | 16777216 | //调整后的参数
+--------------------+----------+
1 row in set (0.00 sec)
再次执行sql,不再报ERROR 2006 (HY000): MySQL server has gone away.
结束。
标签:gone,max,away,ERROR,packet,HY000,allowed,MySQL From: https://www.cnblogs.com/liusingbon/p/16618089.html