You can change this value on the server by setting the max_allowed_packet' variable.

错误描述:

com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1197 > 1024). You can change this value on the server by setting the max_allowed_packet' variable.

解决方案:

通过登录mysql系统(一定要登录到MySQL数据库中):
# mysql -uroot -p
Enter password: 

#去数据库里面查询当前数据库的包长度

mysql>show VARIABLES like '%max_allowed_packet%'; 

#原本数字里面是1024 证实了此问题。mysql默认是1M

#下面是我进行的修改

mysql>SET GLOBAL max_allowed_packet = 1024*1024*14; 

mysql>show VARIABLES like '%max_allowed_packet%'; 

备注:网传还有修改配置文件的方法,此处没有亲测证实,就不放出来了,但是修改配置文件后需要重启服务器,此处不建议使用那种方法!

 

posted @ 2016-08-28 21:21  程序猿司令  阅读(407)  评论(0)    收藏  举报