Sep 13, 2018

How to change the Number or Size of InnoDB Log Files in MySQL

To change the number or the size of your InnoDB redo log files, perform the following steps:

If innodb_fast_shutdown is set to 2, set innodb_fast_shutdown to 1
mysql>show global variables like 'innodb_fast_shutdown'
mysql> SET GLOBAL innodb_fast_shutdown = 1;
After ensuring that innodb_fast_shutdown is not set to 2, stop the MySQL server and make sure that it shuts down without errors (to ensure that there is no information for outstanding transactions in the log, check the error log to ensure there was no problem.).

Copy the old log files (which are named ib_logfile0, ib_logfile1, and so on) into a safe place in case something went wrong during the shutdown and you need them to recover the tablespace.

Delete the old log files from the log file directory.

Edit my.cnf to change the log file configuration.


Start the MySQL server again. mysqld sees that no InnoDB log files exist at startup and creates new ones.

You can’t just change the parameter in the my.cnf file and restart the server. If you do, InnoDB will refuse to start because the existing log files don’t match the configured size.