MySQL 数据库错误:不允许大于 max_allowed_packet 的数据包 - 在插入期间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6973939/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MySQL Database Error: Packets larger than max_allowed_packet are not allowed - during insert
提问by Pascal MARTIN
I've never really had this error before but I am doing a rather large insert. How do I increase this setting? Also, how do I tell how much I am over what's allowed? I tried looking up the error, but i'm not using Fogbugz. Any help would be awesome.
我以前从来没有真正遇到过这个错误,但我正在做一个相当大的插入。如何增加此设置?另外,我如何知道我超出了允许的范围?我尝试查找错误,但我没有使用 Fogbugz。任何帮助都是极好的。
This is a windows installation of mysql.
这是mysql的windows安装。
回答by RedScourge
To set the max to 16MB for example, without requiring a restart, run:
例如,要将最大值设置为 16MB,而不需要重新启动,请运行:
SET GLOBAL max_allowed_packet = 16777216
回答by Pascal MARTIN
How to fix this problem : change the value of the max_allowed_packet
variable in the configuration of your MySQL server.
如何解决此问题:更改max_allowed_packet
MySQL 服务器配置中变量的值。
How to know how much over what's allowed you are : not sure, but I would say that checking the size (in bytes)or your insert
query should give you an idea.
如何知道您允许的范围有多少:不确定,但我会说检查大小(以字节为单位)或您的insert
查询应该会给您一个想法。
For more informations, you should take a look at the following section of the MySQL manual : C.5.2.10. Packet too large.
有关更多信息,您应该查看 MySQL 手册的以下部分:C.5.2.10。数据包过大。
回答by Kobina Ebo Yankson
I faced a similar issue while using XAMPP and what I did was to open the my.ini file via the Config button of MySQL on the XAMPP control and changing max_allowed_packet from 1M to 100M. It solved my problem.
我在使用 XAMPP 时遇到了类似的问题,我所做的是通过 XAMPP 控件上的 MySQL 配置按钮打开 my.ini 文件,并将 max_allowed_packet 从 1M 更改为 100M。它解决了我的问题。