轉載自:http://www.log4cpp.com/learnother/27.htmlhtml
今天在本地調試的時候,把從服務器上導出的sql文件導入到本地的mysql上,可是在執行的過程當中卻收到了這個錯誤mysql
」Error Code: 1118 - 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.「sql
按照提示說要使用ROW_FORMAT=DYNAMIC這個表示,我查看錶信息的確有這個標識,表示很不理解。windows
通過一番探索原來是這麼回事,有以下2種解決辦法服務器
一、使用MyIsam引擎
把表的引擎修改成MyIsam,從新執行插入的sql語句成功。spa
二、修改My.cnf配置文件
首先確認是不是使用Innodb引擎,若是不是那就參考第一種辦法,innodb中能夠經過innodb_file_format設置爲Barracuda,Barracuda中支持 ROW_FORMAT=COMPRESSED調試
對於mysql版本 5.1 表類型orm
innodb中默認的格式是row_format=compact innodb_file_format選項不存在, 也就無從談起Barracuda格式。 設置row_format=dynamic也是沒意義的,因此只能改存儲引擎。htm
對於mysql版本 5.5 表類型get
innodb默認格式是row_format=compact ,插入大於8126的數據會報錯: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.
能夠經過修改my.cnf文件,指定row_format=Barracuda
找到my.cnf文件(windows下是my.ini,若是沒有把my-default.ini拷貝一份重命名成my.ini),在[mysqld]後邊增長兩行
innodb_file_per_table = 1
innodb_file_format = Barracuda
而後重啓mysql服務,並從新建立表
三、使用set global 命令動態的修改
使用以下命令修改
SET GLOBAL innodb_file_format=barracuda;
SET GLOBAL innodb_file_per_table=1;
注意:
1) 修改後的innodb_file_format格式, 隻影響後續建立的表。 也就是後續建立的表,能夠支持把row_format設爲dynamic,以前建立的表仍然會報錯
2) SET GLOBAL 只是在mysql服務器運行期間有效,重啓後innodb_file_format還原爲原來的格式。
3) 判斷一個表是否支持超過10個blob的字段的簡單辦法: show table status like 't1' \G 查看 Row_format , 若是是Compact, 一定不支持, 若是是dynamic, 則支持。