MYSQL Packet for query is too large (1036 > 1024). You can change this value on the server by setting the max_allowed_packet'

 

使用mysql过程中遇到程序报错,如下

MYSQL Packet for query is too large (1036 > 1024). You can change this value on the server by setting the max_allowed_packet'

我的使用环境是 centos7 

参考错误提示和网上分享的方法,使用如下命令,

set global max_allowed_packet = 2*1024*1024*10

但是这个max_allowed_packet的值会被改回1024

继续搜索发现一个方法,首先执行如下命令

 

 

这个应该是配置文件的的使用优先顺序,于是创建/etc/my.cnf文件如下图

然后执行 service mysql restart

 

posted @ 2018-03-08 10:35  江海不系舟  阅读(162)  评论(0)    收藏  举报