溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

mysql錯(cuò)誤:Row size too large (> 8126).

發(fā)布時(shí)間:2020-05-26 02:42:53 來(lái)源:網(wǎng)絡(luò) 閱讀:10970 作者:cjt0115 欄目:MySQL數(shù)據(jù)庫(kù)

mysql版本:mysql 5.6
mysql引擎:默認(rèn)InnoDB
問(wèn)題原因:由于一張定義角色信息表有接近300列,并且多數(shù)是blog的數(shù)據(jù)類型,數(shù)據(jù)存儲(chǔ)時(shí)報(bào)這個(gè)錯(cuò):
Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help
問(wèn)題分析:
You may want to take a look at this article which explains a lot about MySQL row sizes. It's important to note that even if you use TEXT or BLOB fields, your row size could still be over 8K (limit for InnoDB) because it stores the first 768 bytes for each field inline in the page.

The simplest way to fix this is to use the Barracuda file format with InnoDB. This basically gets rid of the problem altogether by only storing the 20 byte pointer to the text data instead of storing the first 768 bytes.
解決方法:
1、修改mysql配置文件my.cnf
innodb_file_per_table
innodb_file_format = Barracuda
2、修改造成這個(gè)問(wèn)題的表屬性
ALTER TABLE $TABLE
ENGINE=InnoDB
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=8;
3、重啟mysql服務(wù)
4、通過(guò)寫(xiě)sql語(yǔ)句修改mysql環(huán)境配置,可以免重啟服務(wù)。當(dāng)然,配置文件中也必須配置上面兩個(gè)參數(shù),這個(gè)操作只是避免此次重啟mysql服務(wù)
mysql> set global innodb_file_per_table =ON;
mysql> SET GLOBAL innodb_file_format = barracuda;

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI