Mysql报Packet for query is too large (1040 > 1024)错误
Linux下mysql 报Packet for query is too large (1040 > 1024)错误的解决方法
项目之前一直正常运行,这几天突然一直提示查询出错,看了下日志发现提示Packet for query is too large (1040 > 1024). You can change this value on the server by setting the max_allowed_packet' variable.错误。百度了解决方法,记录下解决过程。
1.原因
查询数据库返回的数据包太大,超过了默认值。
登录mysql,在控制台输入一下命令查询默认的max_allowed_packet值,发现只有1024
- show VARIABLES like '%max_allowed_packet%';
2.修改默认最大允许包大小
2.1方式一:命令方式
(1).在mysql控制台下输入以下命令,设置max_allowed_packet为20M
- set global max_allowed_packet = 20*1024*1024;
(2).退出mysql,重启mysql服务,再登录myql中查询max_allowed_packet是否修改成功
- show VARIABLES like '%max_allowed_packet%';
2.2方式二:修改配置文件my.cnf方式
- sudo vi /etc/mysql/my.cnf
- max_allowed_packet = 20M
3.注
1、 max_allowed_packet的值最大为1G,设置的值必须为1024的倍数
2、设置完后,需要退出mysql,重新进入才能看到设置后的值
Mysql报Packet for query is too large (1040 > 1024)错误的更多相关文章
- MySql报Packet for query is too large错误
mysql中执行sql的时候报以下错误:Packet for query is too large (1354 > 1024) 原因是mysql一次接收的报文太长,需要调整服务器参数max_al ...
- mysql提示Packet for query is too large (1142 > 1024)解决方案
注:最近mysql一直提示如下错误 Packet for query is too large (1185 > 1024). You can change this value on the s ...
- mysql报错Packet for query is too large (12238 > 1024). You can change this value
今天将项目部署到linux服务器的时候莫名其妙的报一些错误,可是在本地啥错没有,通过实时查看tomcat 的日志之后发现报错是: 实时查看日志: .先切换到:cd usr/local/tomcat5/ ...
- com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1169 > 1024)
### Cause: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1169 > 1024). You ...
- 服务器的日志一直报Packet for query is too large (7632997 > 4194304). You can change this value on the server by setting the max_allowed_packet' variable.的解决方法
服务器的日志一直报Packet for query is too large (7632997 > 4194304). You can change this value on the serv ...
- mysql Packet for query is too large (1185 > 1024)异常
注:最近mysql一直提示如下错误 Packet for query is too large (1185 > 1024). You can change this value on the s ...
- nested exception is com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1044 > 1024
HTTP Status 500 - type Exception report message description The server encountered an internal error ...
- 问题: Packet for query is too large (1786 > 1024). You can change this value on the server by setting the max_allowed_packet' variable.
错误描述: 今天在手机端查看之前上线的项目时,突然报了下面的错误.再之后用电脑登陆,其他设备登陆都一直报这个错误. 错误信息: ### Error querying database. Cause: ...
- Linux服务器上日志报com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1783 > 1024). You can change this value on the server by setting the max_allowed_packet' variable.
在做查询数据库操作时,报了以上错误,还有out of memery heap hacp ,原因是MySQL的max_allowed_packet设置过小引起的,我一开始设置的是1M,后来改为了20M ...
随机推荐
- apache make
https://jingyan.baidu.com/article/7e4409533d7f0f2fc0e2ef91.html 1. apr apr-util http://archive.apach ...
- JSON数组对象某个属性值查找
1.引用国外开源Linq写法的js框架 地址:https://archive.codeplex.com/?p=jslinq https://www.nuget.org/packages/jslinq ...
- [转][Dapper]SQL 经验集
condition.Append(" AND ChineseName like @name"); p.Add("@name", "%" + ...
- PHP调用OCX控件的具体方法
需要设置php.ini文件,找到这行com.allow_dcom=true,把com组件支持启用 使用PHP调用OCX控件,本不是个难题,但现实中采用flash回避的方法更通用.真正使用ocx的不多, ...
- Express详解
express() 创建一个express应用程序 var express = require('express'); var app = express(); app.get('/', functi ...
- 基础html和css知识
No1.HTML 1.网页结构 网页结构一般都包含文档声明DOCTYPE,并且在head中的meta应该包含编码格式.关键字.网页描述信息.简单格式如下: <!DOCTYPE html> ...
- springcloud(七) feign + Hystrix 整合 、
之前几章演示的熔断,降级 都是 RestTemplate + Ribbon 和 RestTemplate + Hystrix ,但是在实际开发并不是这样,实际开发中都是 Feign 远程接口调用. ...
- 由python的math.log想到的问题
result = math.log(243,3) print(result) 输出5.0 print("%f"%result) 还是输出5.0 看出问题了吗?对,没错.int(5. ...
- PHP截取中文不乱吗
function utf_substr($str, $len) { for ($i = 0; $i < $len; $i++) { $temp_str = substr($str, 0, 1); ...
- the difference between fopen&open
[the difference between fopen&open] fopen是C标准API,open是linux系统调用,层次上fopen基于open,在其之上.fopen有缓存,ope ...