Saturday, July 4, 2015

How To Fix: InnoDB Enabled But Not Starting

InnoDB Logo

This is for CentOS, but it should work on Debian/Ubuntu as well. There are two reasons why InnoDB would not start:
  1. It's not enabled in my.cnf
  2. The log files are corrupted

1- Enabling InnoDB From my.cnf

Open my.cnf
vi /etc/my.cnf

Find and Delete --skip-innodb
and save my.cnf

Restart MySQL
/etc/init.d/mysql restart

2- Re-create The Log Files

Sometimes InnoDB won't start even if it's enabled from my.cnf. Most of the times, the reason is because the log files are corrupted.

When these log files are corrupted, MySQL will skip InnoDB storage engine and will not start it.

To fix this, MySQL has to be stopped, the log files has to be removed, and MySQL should be restarted. This will re-create the log files and start InnoDB storage engine.

#Stopping MySQL
/etc/init.d/mysql stop
#Renaming Log Files to keep them as a backup
mv /var/lib/mysql/ib_logfile0 /var/lib/mysql/ib_logfile0.bak
mv /var/lib/mysql/ib_logfile1 /var/lib/mysql/ib_logfile1.bak
#Restarting MySQL
/etc/init.d/mysql start



Any Questions? Please let me know below!