For the last few days I’ve been moving MySQL databases around at work. Being a bit in a rush and overconfident (I have backups!), I was simply detaching the /var/lib/mysql volume on one host (running Amazon AMI and MySQL) and attaching it to another host (running CentOS 7 and MariaDB).
It’s not surprising that I got this error: “InnoDB: Error: log file ./ib_logfile0 is of different size“. Gladly, this ServerFault thread provided enough hints for me to solve the problem. In a nutshell:
- Temporarily comment out the InnoDB log file size setting (e.g.: innodb_log_file_size = 64M) in /etc/my.cnf.
- Set innodb_fast_shutdown to 0 (read more).
- Restart the MySQL service once or twice.
- Uncomment the log file size setting.
- Set InnoDB fast shutdown back to default or remove it from your my.cnf altogether.
- Celebrate!
Knowing how little I learn from my own mistakes, I’m sure I’ll find this post useful in the future.
One thought on “Fixing “InnoDB: Error: log file ./ib_logfile0 is of different size””