How To Fix: InnoDB has been disabled for this MySQL server.

I was in the middle of installing program that I have been working on and I encountered a very peculiar error, but I was able to eventually get the answer. Not many people have been able to come to the conclusions that I have come to, so this, I am sure, will help a few out there.

I went to add some InnoDB tables and was returned with the error :

“InnoDB has been disabled for this MySQL server.”

I was running Ubuntu Gutsy with my MySQL installed via apt-get install mysql-server-5.0.

Now, most places on the internet keep telling me that I have to uncomment out the line ‘skip-innodb’ from my /etc/mysql/my.cnf file. This file is also known as my.ini file on some other *nix distributions. I am running mysql 5.0 SO this is ALREADY uncommented.

After 3 apt-get -f –purge remove mysql-server-5.0 and and upgrade to Ubuntu Hardy, I recovered the answer. You see, InnoDB is very touchy. If it isn’t told what is going on , it just doesn’t start. It will usually throw NO error upon this issue. I’m not an expert as to why it does this, but that seems to be the case. I found that there are files in the /var/lib/mysql folder that were getting pointed to in some tutorials on MySQL.com. These files were the ibdata1 and the ib_logfile0 files. The program is outputting it’s logs to these files. Now, if InnoDB is supposed to be working, but it’s not, and these files are being pointed at by MyISAM… my understanding is there could be an issue with how the files were created. I did this as root (use sudo in front of each command otherwise)..

>cd /var/lib/mysql
>cp ibdata1 ibdata1.bak
>cp ib_logfile0 ib_logfile.bak
I was just backing them up in case of a misshap. Then I had some fun…
>rm ibdata1 ib_logfile0
After that I ran..
>/etc/init.d/mysql restart
And now my InnoDB options are running. The files have been recreated and it solved and fixed the day :)