版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
mysql数据库在一个表中有12个字段类型为text类型,用于存储富文本框的内容,测试输入少量内容能插入数据到表中,项目上线后发现第11跟12个text类型字段报错。
org.springframework.jdbc.BadSqlGrammarException:
### 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 involve com.naturent.medical.dao.common.CaseHistoryMapper.update-Inline
### The error occurred while setting parameters
### SQL: update case_history SET explain11 = ? where caseHistoryId = ?
### 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.登入数据库修改参数
C:\Users\Administrator>mysql -h host -u -user -p
//执行两条命令
mysql> set global innodb_file_per_table=1
mysql> set global innodb_file_fromat=Barracuda;
2.然后在修改该表的参数(user为表名)
ALTER TABLE user
ENGINE=INNODB
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=8;
网上查阅需要修改mysql配置文件,我这里没有修改,也能正常插入数据