报错如下:
ERROR 1118 (42000) at line 274: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB pr
efix of 0 bytes is stored inline
或者
ERROR 1118 (42000) at line 1240: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
解决方法:
1.my.cnf文件的[mysqld] 添加配置
max_allowed_packet = 67108864
innodb_page_size = 64KB
注:innodb_page_size最大为64kb,然后重启mysql,修改innodb_page_size后,重启前需要清空data下的文件,否则会报错。
2.登录mysql,关闭 innodb_strict_mode
SET GLOBAL innodb_strict_mode = 0;
然后试下能否创建表成功,如果不能,再进行第三步
3.建表语句把utf8mb4修改为utf8,可减少字节数
ENGINE=InnoDB DEFAULT CHARSET=utf8
或者再增加ROW_FORMAT=COMPRESSED
创建完成后,最后将innodb_strict_mode 复原
SET GLOBAL innodb_strict_mode = 1;