简体   繁体   English

MySQL 5.5 LONGBLOB列数据对于第1行的列'x'而言太长

[英]MySQL 5.5 LONGBLOB Column Data too long for column 'x' at row 1

I have a column in my MySQL database that stores images as a byte array. 我的MySQL数据库中有一列将图像存储为字节数组。

I am trying to update a row to insert a new image. 我正在尝试更新一行以插入新图像。 The new image is 163K, and when I convert it to a byte[], the number of elements in the array is 167092. When I run the stored procedure that does the update, I get an error "Data too long for column 'x' at row 1. I already have an existing image in the database that has 8844 byte[] elements when converted. 新映像为163K,当我将其转换为byte []时,数组中的元素数为167092。运行存储过程进行更新时,出现错误“列'x的数据太长” '在第1行。我已经在数据库中拥有一个现有图像,该图像在转换时具有8844个byte []元素。

The column datatype is LONGBLOB. 列数据类型为LONGBLOB。 From my understanding, I should have appox 4Gb to work with. 据我了解,我应该使用4x的appox。

I have tried updating my my.ini file to make the MAX_ALLOWED_PACKETS=16M and I even tried 100M. 我尝试更新my.ini文件以使MAX_ALLOWED_PACKETS = 16M,甚至尝试100M。

I am using the MySQL .NET Connector libraries to execute my stored procedures. 我正在使用MySQL .NET连接器库执行我的存储过程。

Does anyone have any ideas on how to fix this issue? 是否有人对如何解决此问题有任何想法? I know I could store the image paths instead of storing the images directly into the database. 我知道我可以存储图像路径,而不是将图像直接存储到数据库中。 But I would like to know how to solve my current issue and still store the images in the database first before trying to change my approach. 但是我想知道如何解决当前的问题,并且仍然在尝试更改方法之前先将图像存储在数据库中。

I've had exactly the same problem... 我遇到了完全一样的问题...

In my case I was passing the LONGBLOB via a TEXT parameter since I wanted to use CONCAT inside the stored procedure in order to create dynamic SQL. 就我而言,我要通过TEXT参数传递LONGBLOB,因为我想在存储过程中使用CONCAT来创建动态SQL。

The solution was simply to change TEXT into LONGTEXT. 解决方案只是将TEXT更改为LONGTEXT。 That's it :) That really took some time to figure out... 就是这样:)真的花了一些时间来找出...

Hope I could help even after almost three years. 希望即使三年后我也能提供帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MySQL数据对于行“ XX”的列“ XX”而言太长-LongBlob列 - MySQL Data too long for column 'XX' at row 'XX' - LongBlob Column MySQL数据太长,无法在LONGBLOB上出现列 - MySQL data is too long for column occuring on LONGBLOB 数据太长,无法显示第1行的MySQL 5.6列 - Data too long for column at row 1 mysql 5.6 错误:MySQL中第1行的“ MEDIUMBLOB”列的数据“ imagen”的数据过长 - Error: Data too long for column 'imagen' at row 1 with column 'MEDIUMBLOB' in MySQL 数据截断:第 x 行的“xxx”列的数据太长(布尔值) - Data truncation: Data too long for column 'xxx' at row x (boolean) MySQL从表中删除此错误是“数据太长,第1行的列“ x”” - mysql whlie deleteing from the table this error is coming 'Data too long for column 'x' at row 1' 查询无效:对于'y'行的列'x',数据太长 - Invalid query: Data too long for column 'x' at row 'y' 数据对于mysql列太长 - Data too long for column mysql 带有MySQL的Django:DatabaseError(1406,“第1行的列'名称'的数据太长了”) - Django with MySQL: DatabaseError (1406, “Data too long for column 'name' at row 1”) 第 1 行的“用户”列的数据太长 - Data too long for column 'users' at row 1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM