例子:給表增加一列報(bào)錯(cuò):
alter table student add column `aggregate_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '聚合id'
1118: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
單行記錄的合計(jì)最大大小超過了8126字節(jié),那么根據(jù)文檔描述的話,使用dynamic行格式的表行最大大小可以達(dá)到65536字節(jié)(因?yàn)閙ysql內(nèi)部使用了2個(gè)字節(jié)來表示字段長度,因此可以表示最大65535的長度)
CREATE TABLE `student` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(700) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '名字',
`picture` varchar(127) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`description` varchar(1023) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`college_id` bigint(20) NOT NULL DEFAULT '0',
`create_time` bigint(20) NOT NULL,
`user_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '用戶id',
`data` json DEFAULT NULL COMMENT 'ext',
`status` int(11) NOT NULL DEFAULT '0' COMMENT '狀態(tài)',
PRIMARY KEY (`id`),
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4
計(jì)算:bigint 8 byte
80*8+700+127+1023+11*4=2534
雖然沒有算上json字段的長度,感覺計(jì)算結(jié)果對不上。看了一些博客修改varchar為text并不能解決,需要修改mysql的配置文件,并且重啟。但實(shí)際上,很多地方修改表的字段varchar啥的都會失敗,跟alter語句的執(zhí)行過程有關(guān),有興趣可以了解下,最有效的辦法就是修改key_block_size的大小。
https://blog.51cto.com/hcymysql/4369124
https://www.jianshu.com/p/2c96a7f1b8aa
經(jīng)過調(diào)研,“row_size>8126”報(bào)錯(cuò)應(yīng)該是一個(gè)固定提示,所以可以不用糾結(jié)了!文章來源:http://www.zghlxwxcb.cn/news/detail-546873.html

https://mariadb.com/kb/en/innodb-strict-mode/文章來源地址http://www.zghlxwxcb.cn/news/detail-546873.html
到了這里,關(guān)于MySQL排查問題row size too large (> 8126). Changing some columns to TEXT or BLOB may help.的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!