今天遇到的关于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 ...
随机推荐
- IndexOf("authentication failed") > -1
if (e.Value.Error.Message.IndexOf("authentication failed") > -1) { strFailMessag ...
- pasa的安装
介绍: http://pasapipeline.github.io/ 参考别人的安装教程:http://sihua.us/pasa.htm 软件下载: https://github.com/PASAp ...
- jsp状态管理
http无状态协议 服务器记不住你 每次浏览器访问,服务器不会特点保存相应信息,故记不住你 jsp状态存储的两种机制 cookie 存储在客户端 用途: 1.简化登陆 2.追踪特定对象 3.保存用户常 ...
- ✡ leetcode 163. Missing Ranges 找出缺失范围 --------- java
Given a sorted integer array where the range of elements are in the inclusive range [lower, upper], ...
- 体验一下cygwin
一直在windows下使用gvim,为了更方便的使用cscope.先是写了bat脚本,发现太不方便了. 于是想到了cygwin.下载安装工具就可以了进行默认安装了,配置比较简单. 调整包: ./set ...
- Python-Jenkins 查询job是否存在
def check_jobs_from_jenkins(job_names): if isinstance(job_names, str): job_names = [job_names] job_d ...
- Python copy and deepcopy
Python中的对象之间赋值时是按引用传递的,如果需要拷贝对象,需要使用标准库中的copy模块. 1. copy.copy 浅拷贝 只拷贝父对象,不会拷贝对象的内部的子对象. 2. copy.deep ...
- MyEclipse Spring 学习总结一 Spring IOC容器
一.Spring IOC容器---- Spring AllicationContext容器 程序的结构如下: 1.首先在MyEclipse 创建创建Java Project 2.创建好后,添加spin ...
- Openstack Neutron OVS ARP Responder
ARP – Why do we need it? In any environment, be it the physical data-center, your home, or a virtual ...
- Shiro 整合SpringMVC 并且实现权限管理
Apache Shiro是Java的一个安全框架.目前,使用Apache Shiro的人越来越多,因为它相当简单,对比Spring Security,可能没有Spring Security做的功能强大 ...