mysql 一次插入多个text字段类型的数据 Row size too large (> 8126)

mysql插入的一行数据中有多个text类型的字段时报错如下:

错误代码: 1118
Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.

1. 首先text字段较多,参数一般会比较大,设置max_allowed_packet为合适的大小;

2. 参照错误提示, "Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help",修改表的行格式为"DYNAMIC"或“COMPRESSED”;

注意:必须先将文件格式设置成Barracuda:set global innodb_file_format=Barracuda;,再用ALTER TABLE tablename ROW_FORMAT=COMPRESSED;去修改才能生效。此处参考:https://www.cnblogs.com/wilburxu/p/9435818.html

参考:https://blog.csdn.net/yyongsheng/article/details/88537343 

原文地址:https://www.cnblogs.com/lijianchuan/p/13271593.html