简体   繁体   English

mysql- Mysql2 :: Error:数据太长,第1行的列'description'

[英]mysql- Mysql2::Error: Data too long for column 'description' at row 1

I built a scraper and it doesn't seem to like my description length. 我制作了一个刮板,它似乎不喜欢我的描述长度。 I altered the column to varchar(500) but no dice. 我将列更改为varchar(500),但没有骰子。 I think I need to convert to text, but I am not sure how to. 我想我需要转换为文本,但是我不确定该怎么做。 Does that make sense in my case? 就我而言,这有意义吗? Thanks! 谢谢!

Error- 错误-

Mysql2::Error: Data too long for column 'description' at row 1: INSERT INTO sammiches ( country , created_at , description , image , name , updated_at ) VALUES ('Italy', '2013-05-03 01:10:08', 'In Italy, panino is the word for a sandwich made from bread other than sliced bread, in which case Italians call it a tramezzino or porco. Examples of bread types used are ciabatta, rosetta and baguette. The bread is cut horizontally and filled with deli ingredients such as salami, ham, cheese, mortadella, or other food, and sometimes served warm after having been pressed by a warming grill. In the United States, United Kingdom and Canada, the term panini has been adopted to refer to a pressed and toasted sandwich; there is widespread availability and use of sandwich presses, often known as \\"panini presses\\" or \\"toasted sandwich makers.\\"', '/wiki/File:Italian_Sandwich.jpeg', 'Panini', '2013-05-03 01:10:08') (ActiveRecord::StatementInvalid) Mysql2 :: Error:数据太长,无法在第1行的列'description'插入到sammichescountrycreated_atdescriptionimagenameupdated_at )VALUES('Italy','2013-05-03 01:10:08 ','在意大利,panino是指用除切片面包以外的面包制成的三明治的三明治,在这种情况下,意大利人称其为tramezzino或porco。使用的面包类型包括恰巴塔面包,罗塞塔面包和法式长棍面包。在其中充满了熟食成分,例如萨拉米香肠,火腿,奶酪,熟香肠或其他食物,有时在被加热的烤架压过后可以加热。在美国,英国和加拿大,“ panini”一词是指压制和烤制的三明治;三明治压制机(通常称为“帕尼尼压制机”或“烤制三明治机”)得到广泛使用和使用。','/wiki/File:Italian_Sandwich.jpeg','Panini' ,'2013-05-03 01:10:08')(ActiveRecord :: StatementInvalid)

Your length is about 650 characters now. 您的长度现在约为650个字符。 Try to increase more. 尝试增加更多。

the type VARCHAR() just can go up to 255 characters. 类型VARCHAR()最多可以包含255个字符。 Try TEXT instead. 请尝试使用TEXT。

http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html

-- if a table restrict you to insert data becasue the length is smaller and -- you realy want to get rid of the restriction -- do this -如果表限制您插入数据,因为它的长度较小,并且-您确实想摆脱限制-请执行此操作

show global variables like '%sql%mode'; 显示全局变量,例如'%sql%mode'; set global sql_mode='NO_ENGINE_SUBSTITUTION'; 设置全局sql_mode ='NO_ENGINE_SUBSTITUTION'; -- also set it here -- /etc/my.cnf -- http://dev.mysql.com/doc/refman/5.6/en/sql-mode.html -也在此处设置-/etc/my.cnf- http ://dev.mysql.com/doc/refman/5.6/zh-CN/sql-mode.html

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

相关问题 错误:MySQL中第1行的“ MEDIUMBLOB”列的数据“ imagen”的数据过长 - Error: Data too long for column 'imagen' at row 1 with column 'MEDIUMBLOB' in MySQL 数据太长,无法显示第1行的MySQL 5.6列 - Data too long for column at row 1 mysql 5.6 数据太长,无法访问此列mysql错误 - data too long for this column mysql error MySQL数据对于行“ XX”的列“ XX”而言太长-LongBlob列 - MySQL Data too long for column 'XX' at row 'XX' - LongBlob Column MySQL 5.5 LONGBLOB列数据对于第1行的列'x'而言太长 - MySQL 5.5 LONGBLOB Column Data too long for column 'x' at row 1 数据对于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”) Rails 4-Mysql2 :: Error:索引列大小太大 - Rails 4 - Mysql2::Error: Index column size too large MySQL从表中删除此错误是“数据太长,第1行的列“ x”” - mysql whlie deleteing from the table this error is coming 'Data too long for column 'x' at row 1' {Mysql2 :: Error}使用mysql2时,列数与第1行的值数不匹配 - {Mysql2::Error} Column count doesn't match value count at row 1 when use mysql2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM