Packet for query is too large (1032 > 1024). You can change this value on the server by setting the
2017-10-30 09:11
621 查看
问题描述:
后台开发过程中,运行程序,加载数据时出现问题,没显示数据提示错误:
Packet for query is too large (1032 > 1024). You can change this value on the server by setting the max_allowed_packet’ variable.
问题分析:
mysql max_allowed_packet 设置过小导致记录获取或者更新失败mysql 根据配置文件会限制server接受的数据包大小
查看目前配置
输入sql语句
show VARIABLES like ‘%max_allowed_packet%’;
输出结果:
Variable_name | value |
---|---|
max_allowed_packet | 1024 |
slave_max_allowed_packet | 1073741824 |
问题解决
方法1:使用sql语句设置max_allowed_packet的值先使用如下语句进行设置,
set @@max_allowed_packet=2*1024*1024
提示错误:
Error Code: 1621. SESSION variable ‘max_allowed_packet’ is read-only. Use SET GLOBAL to assign the value
改为如下语句
SET GLOBAL max_allowed_packet=1073741824
正常执行,成功修改max_allowed_packet的值
方法2:修改配置文件
编辑my.cnf来修改(windows下my.ini),在[mysqld]段或者mysql的server配置段进行修改。
max_allowed_packet = 20M
如果找不到my.cnf可以通过mysql –help | grep my.cnf去寻找my.cnf文件。
相关文章推荐
- packet for query is too large <1781> 1024 >. you can change this value on the server by setting the
- Linux服务器上日志报com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1783 > 1024). You can change this value on the server by setting the max_allowed_packet' variable.
- Packet for query is too large (1029 > 1024). You can change this value on the server by setting the
- 服务器的日志一直报Packet for query is too large (7632997 > 4194304). You can change this value on the server by setting the max_allowed_packet' variable.的解决方法
- Packet for query is too large (1986748 > 1048576). You can change this value on the server by setting the max_allowed_pa
- MySQL5中大数据错误:Packet for query is too large (****** > ******). You can change this value on the server by setting the max_allowed_packet' variable.;
- Packet for query is too large (2044 > 1024). You can change this value on the server.........
- mysql Packet for query is too large (5058927 > 4194304). You can change this value on the server by
- Packet for query is too large (1986748 > 1048576). You can change this value on the server by
- mysql5中大数据错误:Packet for query is too large (***>***). You can change this value on the ser
- mysql5中大数据错误:Packet for query is too large (***>***). You can change this value on the ser
- mysql5中大数据错误:Packet for query is too large (1117260 > 1048576). You can change this value on the ser
- Tomcat 报错:Packet for query is too large (12238 > 1024). You can change this value
- Packet for query is too large (12238 > 1024). You can change this value
- Packet for query is too large (12238 > 1024). You can change this value
- 【问题解决】Packet for query is too large (1165 > 1024). You can change this value
- Packet for query is too large (12238 > 1024). You can change this value
- Packet for query is too large (1166 > 1024). You can change this value
- You can change this value on the server by setting the 'max_allowed_packet' variable.
- Mysql You can change this value on the server by setting the max_allowed_packet' variable. 异常