MySQL升级5.6恢复dmp时报:MySQL server has gone away/The size of BLOB/TEXT data inserted…
在升级mysql到5.6恢复dmp数据文件时遇到两个问题
1、ERROR 2006 MySQL server has gone away
2、ERROR:The size of BLOB/TEXT data inserted in one transaction is greater than 10% of redo log size. Increase the redo log size using innodb_log_file_size.
第一个问题:
是由于dmp文件过大,导致MySQL server断开了连接。
解决办法是修改mysql配置文件my.ini(windows),my.cnf(linux)
[mysqld]
max_allowed_packet=500M
[mysqldump]
max_allowed_packet=500M
其他参数也可能影响连接,值得注意:
SET GLOBAL event_scheduler = 1;
wait_timeout=2880000
interactive_timeout = 2880000
read_buffer_size
read_rnd_buffer_size
注:具体数值请根据自身需求进行相应设置
第二个问题:
ERROR:The size of BLOB/TEXT data inserted in one transaction is greater than 10% of redo log size. Increase the redo log size using innodb_log_file_size.
解决办法是在配置文件中加大innodb_log_file_size 的参数值
A change in the 5.6.20 release notes:
Redo log writes for large, externally stored BLOB fields could overwrite the most recent checkpoint. The 5.6.20 patch limits the size of redo log BLOB writes to 10% of the redo log file size. The 5.7.5 patch addresses the bug without imposing a limitation. For MySQL 5.5, the bug remains a known limitation.
As a result of the redo log BLOB write limit introduced for MySQL 5.6, innodb_log_file_size should be set to a value greater than 10 times the largest BLOB data size found in the rows of your tables plus the length of other variable length fields (VARCHAR, VARBINARY, and TEXT type fields).Failing to do so could result in “Row size too large” errors.
(emphasis mine)
The default for innodb_log_file_size is 50331648, which means the largest BLOB/TEXT value you can create, regardless of data type, is close to 5033164, and you discovered the precise value is 5033932. I suppose internally the calculation involves some fudge factor.
So you need to increase innodb_log_file_size if you want to store larger BLOB/TEXT data. Fortunately, changing the log file size is a lot easier in 5.6 than in earlier versions of InnoDB. Just add a line in your my.ini with the new value, and restart mysqld.
link: http://dba.stackexchange.com/questions/75328/row-size-error-with-mysql