今天遇到的关于mysql的max_allowed_packet的问题
今天,运维组的同学来找我,说是备份池的文件描述没有显示出来,而且是从20号开始就不能显示,之前的文件描述就能显示,而且20号他们上传备份的数据确实是传过来的。但是是在web界面文件描述显示不出来。
先说下文件描述的意思:就是公司的同时使用一个客户端,将他们认为重要的数据一个一个的上传过来(rsync)的方式,然后在中控机上为每个文件生成一个md5的值,最终保存到数据库中的某个字段中(md5),最终进行显示web界面,显示如此:

T2X$D9J%F.png)
T2X$D9J%F.png)
但就是这个项目特别久远,没有使用任何的php框架,所有的代码都是函数式的编程,要是一个文件一个文件的查看下去的话,是会要死人的。
于是,和项目组的另一位老同事讨论这个问题,最后分析的结果是:
(1).可能是在各个节点再往中控机上上传这个md5的文件的时候,没有上传上去,导致获得不到最终的md5文件
(2).查找所有文件中包含md5和insert update之类字样的文件,一个文件一个文件的排查,最终定位到某个文件的一个SQL:
update mission set `md5` = LOAD_FILE('".$target."') where `id` = ".$id
上面的这个sql语句就是在更改md5文件描述符,很明显在20号之后的md5文件并没读取出来。
那为啥没有读取出来呢?
之前的程序什么的都没有进行更改,那只能去查LOAD_FILE()这个mysql函数的用法了
下面是LOAD_FILE()的官方用法:
Reads the file and returns the file contents as a string. To use this function, the file must be located on the server host, you must specify the full path name to the file, and you must have the FILE privilege. The file must be readable by all and its size less than max_allowed_packet bytes. If the secure_file_priv system variable is set to a nonempty directory name, the file to be loaded must be located in that directory. If the file does not exist or cannot be read because one of the preceding conditions is not satisfied, the function returns NULL
其大意就是说:上传的这个文件是需要可读的,而且这个文件的大小必须小于mysql Server的max_allowed_packet的值的。
最终,问题找到了,可能就是max_allowed_packet这个值过小,需要将其改大。
于是,上到mysql的终端:
进行设置:
show variables like "%max_allowed%";
set global max_allowed_packet = 2*1024*1024*10;
注意:必须是退出后,才能生效。
今天遇到的关于mysql的max_allowed_packet的问题的更多相关文章
- Linux中MySQL数据库max_allowed_packet的调整
在MySQL数据库里某表有一个blob字段,当上传文件超过1M的时候出现下面的错误: PreparedStatementCallback; SQL [insert into uos.docfile(r ...
- mysql 设置max_allowed_packet 大小的办法
show VARIABLES like '%max_allowed_packet%'; 第一句是查询 max_allowed_packet 的大小,第二句是重新设定 max_allowe ...
- mysql中max_allowed_packet参数的配置方法(避免大数据写入或者更新失败)
修改方法 1.修改配置文件 可以编辑my.cnf来修改(windows下my.ini),在[mysqld]段或者mysql的server配置段进行修改. 代码如下: max_allowed_packe ...
- mysql里max_allowed_packet的作用
MySQL根据配置文件会限制Server接受的数据包大小.有时候大的插入和更新会受 max_allowed_packet 参数限制,导致写入或者更新失败. 查看目前配置: 代码如下: show VAR ...
- mysql 中 max_allowed_packet 查询和修改
mysql 会根据配置文件限制 server 接收的数据包的大小. 有时候大的插入和更新会被 max_allowed_packet 参数限制,报如下错误: Packet > ). You can ...
- MySQL修改max_allowed_packet
因mysql从库报错Last_IO_Error: Got a packet bigger than 'max_allowed_packet' bytes mysql> show slave st ...
- 修改windows下mysql的max_allowed_packet的值
执行sql报错:Error updating database. Cause: com.mysql.jdbc.PacketTooBigException: Packet for query is to ...
- mysql修改max_allowed_packet数据包最大值
在windows环境下!!!! 1.找到my.inc文件,不是你的安装目录路径,是C:\ProgramData\MySQL\MySQL Server 5.7这个路径,注意 ProgramData 文件 ...
- mysql 修改max_allowed_packet
-- 查询max_allowed_packetshow VARIABLES like '%max_allowed_packet%'; 修改 my.ini 或 my.cnf [mysqld] max_a ...
随机推荐
- HDU 2176
http://acm.hdu.edu.cn/showproblem.php?pid=2176 nim博弈的模型.要输出先手第一次取的情况,考虑角度是留给对手必败态 #include <iostr ...
- 黑马程序员:Java编程_动态代理
=========== ASP.Net+Android+IOS开发..Net培训.期待与您交流!=========== 长沙人从长沙的代理商手中买宏基电脑和直接跑到宏基总部买电脑,最终的主体业务目标有 ...
- 导入别人的flex项目出现的问题
1.unable to open 'D:/flex-projects/RoadService/WebContent/WEB-INF/flex/services-config.xml' 这种情况是因为别 ...
- Kerberos认证原理简介
1.1 What is Kerberos 1.1.1 简单介绍 Kerberos是一个用于鉴定身份(authentication)的协议, 它采取对称密钥加密(symmetric-key crypto ...
- 帝国CMS灵动标签e:loop
头条调用方法 1 [e:loop={'selfinfo',5,13,0,'firsttitle=2'}]<a href="<?=$bqsr[titleurl]?>" ...
- PHP curl传 json字符串
$ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_seto ...
- map的应用
1.map最基本的构造函数: map<string , int >mapstring; map<int ,string >mapint; map&l ...
- 应用aspose.word破解版实现word转pdf
import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import java.io.File; import java ...
- Node.js知识点
1. 入口文件app.js里的路由,按顺序执行: 2.
- shell问题(转)
一个同学问我一个问题,说有以下文件内容,要求输出为特定的格式.这里就献丑给出一个处理的方法吧,由于时间关系可能我的答案并不是最好的,但是我尽量将我的答案讲解明白,让你理解处理的方法.如果您有简单明了的 ...