Packet for query is too large(mysql写入数据过大)

错误现象:(com.logicaldoc.core.security.dao.HibernateUserDAO: 102) -- Packet for query is too large (1086 > 1024). You can change this value on the server by setting the max_allowed_packet' variable.
org.hibernate.exception.GenericJDBCException: 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,其默认值为1048576(1M),
查询:show VARIABLES like '%max_allowed_packet%';

修改此变量的值:

my.cnf文件中的[mysqld]段中的"max_allowed_packet = 1M",(可能有些文件会没有这一行的)

格式为:

[mysqld]

max_allowed_packet = 1M ( 将1M更改为4M(如果没有这行内容,增加一行)),

保存,

重起MySQL服务。

现在可以load大于1M的文件了


你可能感兴趣的:(mysql,数据库)