com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1086 > 1024).
程序员文章站
2024-03-12 16:42:26
...
报错:com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1086 > 1024). You can change this value on the server by setting the max_allowed_packet’ variable.
原因是mysql的max_allowed_packet设置过小引起的
解决办法:把该参数设置大点
1)在Navicat工具:
查看要修改的参数值:
show VARIABLES like '%max_allowed_packet%';
然后设置:
set global max_allowed_packet = 2*1024*1024*10
这是设置数据接收值为20M
最后退出Navicat工具,重启MySQL数据库,然后再登录工具查询值,发生改变即修改成功
2)直接修改配置文件
linux服务器中我直接进入etc目录下编辑配置文件my.cnf,修改max_allowed_packet = 1M 中的参数值1M改为任意较大的数字,若没有直接添加max_allowed_packet = 20M
然后保存退出重启mysql数据库修改成功。
重启mysql命令为service mysqld restart
上一篇: 20200724Java多态练习
下一篇: 轻松掌握java责任链模式
推荐阅读
-
com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1086 > 1024).
-
Packet for query is too large (1986748 > 1048576). Yo_MySQL
-
mysql- Packet for query is too large (60 > -1).
-
com.mysql.jdbc.PacketTooBigException: Packet for query is too large 异常解决办法
-
使用mybatis generator 出现Packet for query is too large (5,150 > 1,024)错误[ubuntu系统]
-
MySQL Packet for query is too large 问题及解决方法
-
mysql: Packet for query is too large 和Data too long for column
-
mysql: Packet for query is too large 和Data too long for column
-
mysql: Packet for query is too large 和Data too long for column
-
mysql: Packet for query is too large 和Data too long for column