How to fix MySQL ERROR 1118 (42000): increase innodb_log_file_size
In the previous article, we looked at how to import a large database into MySQL via the command line. During that process, you might hit another error:
ERROR 1118 (42000) at line 354585: 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.
Fortunately, the error message tells you exactly what to do. Here’s where to find the setting.
Problem: MySQL fails on import with ERROR 1118 (42000).
Why the error happens
InnoDB writes every change to the redo log before writing it to the table. A single row with a large BLOB or TEXT value (in WordPress, typically a big post_content or a serialized option) must fit into 10% of the redo log. With the old default of 5 MB, any value larger than about 500 KB fails.
Step 1. Stop MySQL
XAMPP on Linux:
sudo /opt/lampp/xampp stop
Step 2. Change innodb_log_file_size
Open /opt/lampp/etc/my.cnf and find the innodb_log_file_size line. The default is usually 5M; change it to something larger, like 64M. If the line isn’t there, add it under the [mysqld] section:
[mysqld] innodb_log_file_size = 64M
Step 3. Start MySQL
sudo /opt/lampp/xampp start
To check that the new value is active, run this query in phpMyAdmin or in the mysql client:
SHOW VARIABLES LIKE 'innodb_log_file_size';
If MySQL doesn’t start: old log files
MySQL 5.6.8+ and MariaDB 10.0+ resize the redo log files automatically on start. Older versions refuse to start when the size in my.cnf doesn’t match the existing files. In that case, after a clean stop (Step 1), move the old files out of the data directory and start MySQL again; it creates new files of the right size:
/opt/lampp/var/mysql/ib_logfile0 /opt/lampp/var/mysql/ib_logfile1
Do this only after MySQL has stopped normally. If MySQL crashed, the redo log may contain changes that are not yet in the tables, and deleting it loses that data.
Other settings that affect large imports
If the problem persists, check these settings in my.cnf and adjust them as needed. The most important one for imports is max_allowed_packet: it limits the size of a single SQL statement, and a dump with long INSERT lines fails with “MySQL server has gone away” when it’s too small.
max_allowed_packet = 128M wait_timeout = 28800 interactive_timeout = 28800 key_buffer_size = 256M table_open_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M
NOTE: innodb_log_file_size also affects write performance: a larger redo log means less frequent flushing. For local development, 64 MB is usually enough. Production servers with large WooCommerce databases often use 256 MB or more.