Thursday, December 18, 2014

Unknown table engine 'InnoDB'

In the name of Allah, Most Gracious, Most Merciful.

In this article i will be discussing solution for Mysql engine corruption. Some time it happens that 'InnoDB' engine become unavailable and you will get "Unknown table engine 'InnoDB'" error while accessing a table based on 'InnoDB' engine. You can see supported database engines by using following command.

mysql> show engines;

If 'InnoDB' engine is missing from this list then you need to do following steps to bring it back online. Login with root user and execute following.

$ service mysqld stop

Shutting down MySQL.   [  OK  ]

Now find the mysql log file location and remove the log files. If you don't know the location, you can check /var/lib/mysql and delete following files

$ cd /var/lib/mysql  
$ rm -f ib_logfile0 ib_logfile1

Now kill any mysql running processes. you can find the process id and use kill command to kill them.

$ ps aux | grep mysql
$ kill -9 xxx

replace xxx with process id of mysql. Once done, start mysql

$ service mysqld start
Starting MySQL...............................              [  OK  ]

mysql> show engines;

Now it should list InnDB engine.

I hope it will serve the purpose.