MySQL根据配置文件会限制Server接受的数据包大小。有时候大的插入和更新会受 max_allowed_packet 参数限制,导致写入或者更新失败。
查看目前配置:
代码如下:
show VARIABLES like '%max_allowed_packet%';
显示的结果为:
代码如下:
+--------------------+---------+
| Variable_name | Value |
+--------------------+---------+
| max_allowed_packet | 1048576 |
+--------------------+---------+
| Variable_name | Value |
+--------------------+---------+
| max_allowed_packet | 1048576 |
+--------------------+---------+
以上说明目前的配置是:1M
max_allowed_packet:指代mysql服务器端和客户端在一次传送数据包的过程当中数据包的大小
这个是定义mysql服务器端和客户端在一次传送数据包的过程当中数据包的大小
定义过大,比如max_allowed_packet=8092,有可能服务器端太忙,来不及接收,或者网络太差,会容易造成丢包
修改方法:
vi /etc/my.cnf
max_allowed_packet=100M
service mysqld restart