【转载】Error Code: 2006 - MySQL server has gone away

本文详细介绍了在导入数据库时遇到SQLyog报错ErrorCode:2006-MySQLserverhasgoneaway的问题,以及如何通过调整max_allowed_packet参数来解决此问题。包括在Windows和Linux环境下的操作步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文地址:http://hi.baidu.com/chinalwb/blog/item/8b83ce14cfa3954121a4e96c.html

 




刚才在导入数据库的时候 SQLyog 报错了

Error Code: 2006 - MySQL server has gone away


搜了下,说是max_allowed_packet (MySQL的一个参数)设置的值不够大。


那我改下就行了 嘿嘿


In Windows:


In the MySQL server installation directory,

in my.ini file, add the following line under [mysqld] in SERVER SECTION.

max_allowed_packet = 16M



In Linux:


Copy the my-xxx.cnf file from /usr/share/mysql to /etc as my.cnf


xxx can be small, medium, large, huge ... depending on the requirement.


$ cp /usr/share/mysql/my-xxx.cnf /etc/my.cnf


In the my.cnf file, change the default

max_allowed_packet = 1M
to
max_allowed_packet = 16M

Save the file and restart MySQL server.


==================================================================


类似于oracle中数据缓冲区的概念,数据量过大数据导入失败。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值