mysql:Cause: com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large

### Cause: com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large (4,246,837 > 4,194,304). You can change this value on the server by setting the 'max_allowed_packet' variable.
; Packet for query is too large (4,246,837 > 4,194,304). You can change this value on the server by setting the 'max_allowed_packet' variable.; nested exception is com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large (4,246,837 > 4,194,304). You can change this value on the server by setting the 'max_allowed_packet' variable., path=/user/addList}]

 

查看 max_allowed_packet 参数:

show VARIABLES like '%max_allowed_packet%';

结果:

mysql:Cause: com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large_第1张图片

修改方法:

1、修改配置文件。编辑my.cnf来修改(windows下my.ini)

max_allowed_packet = 20M

2、在mysql命令行中暂时修改,重新启动MYSQL后,会恢复原来的值。

//这里的数值为字节数,这里改为20M,需要重新登陆客户端起作用
set global max_allowed_packet = 2*1024*1024*10

mysql:Cause: com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large_第2张图片

你可能感兴趣的:(mysql)