环境运维

[ERR] 1118 - Row size too large (> 8126). Changing some columns to TEXT or BLOB

[ERR] 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.

MySQL——MySQ行记录大小超过限制

首先是MySQL配置文件my.cnf中添加两个配置项:

innodb_file_per_table=1 //
innodb_file_format = Barracuda //DYNAMIC行格式只有在Barracuda文件格式下才支持

修改表行格式ROW_FORMAT

alter table table_name ROW_FORMAT=DYNAMIC;

修改之后,执行 show table status like ‘table_name’,可以看到Row_format这一列对应的值已经变成了dynamic,再写入数据的时候就不会报错了。

问题背景

问题出现在Spark写MySQL的场景:要写入MySQL的DataFrame中有90多个列,其中有10多个列为字符串类型,且长度较长(大于1000);对应的要写入的MySQL表使用的是InnoDB引擎,这些较大的字符串所对应的列在MySQL中设置为text类型。

 

原文链接:https://blog.csdn.net/lovetechlovelife/article/details/107965881