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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM