mysql之Row size too large (> 8126)问题解决方案

mysql之Row size too large (> 8126)问题解决方案

问题描述:

项目中涉及文本存储(mysql数据库中设置为text),如果要存储的数据过大,项目中报错如下:

### Error updating database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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.
### The error may exist in file [E:\fjt\2020\workspace\SWAP_background_service\target\classes\mybatis\mapper\equipment_manage\HistoryMapping.xml]
### The error may involve com.liansheng.swap.mapper.equipment_manage.HistoryMapper.update-Inline
### The error occurred while setting parameters
### SQL: update swap_variable_history          SET hour01 = ?          WHERE deptid = ?  and variableid = ? and collectorid = ?
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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.设置mysql全局变量
设置命令:SET GLOBAL innodb_file_format='Barracuda';
检查命令:show GLOBAL VARIABLES LIKE '%file_format%';
2.设置对应表的属性(行格式) alter table 表名 ROW_FORMAT=COMPRESSED

参考文章:https://blog.csdn.net/fallcreek/article/details/49495915

       http://blog.sina.com.cn/s/blog_8e9cceee0101k65j.html

猜你喜欢

转载自www.cnblogs.com/fujingtao5470/p/12671198.html
今日推荐