Home  >  Article  >  Database  >  ERROR 2006 (HY000) at line xx: MySQL server has gone away 解

ERROR 2006 (HY000) at line xx: MySQL server has gone away 解

WBOY
WBOYOriginal
2016-06-07 15:35:121385browse

:http://blog.163.com/yang__xiaoguang/blog/static/112895152011111295019862/ 1.执行批量的MYSQL语句,例如备份恢复的时候,时间过长。 对应:修改my.cnf中的wait_timeout和interactive_timeout变量 在一些不便修改的情形下,如租用的空间,可以采取sql语


:http://blog.163.com/yang__xiaoguang/blog/static/112895152011111295019862/


1.执行批量的MYSQL语句,例如备份恢复的时候,时间过长。 
对应:修改my.cnf中的wait_timeout和interactive_timeout变量 
在一些不便修改的情形下,如租用的空间,可以采取sql语句修改,如何做呢? 

解决办法

找到my.ini文件

添加一句max_allowed_packet=16M,如果不行将16M再加大

加大wait_timeout也可起一定作用

eg:

wait_timeout=2880000
interactive_timeout 2880000
max_allowed_packet 100M

应用时记住重启数据库哦~~

除此之外,可能还有一些别的buffer_size的变量会影响到,也值得注意 
例如 
read_buffer_size 
read_rnd_buffer_size
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn