max_allowed_packet会重置为1024,这样导致在做查询或插入操作时,项目出现无法访问数据库的情况,报如下错误:

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

这个问题我在网上也看了好多解决办法,大多数都是以在/etc/my.cnf中 set global max_allowed_packet = 2*1024*1024*10(需要重启数据库); 但是这样设置之后也同样会出现之前出现的问题。

本人检测到max_allowed_packet重置为1024后数据库并没有被重启,请问有人遇到这个问题吗?

本人数据库版本mysql  Ver 15.1 Distrib 10.0.26-MariaDB, for Linux (x86_64) using readline 5.1