Magento installation database connection error

Photo Credit: striatic via Compfight cc
Photo Credit: striatic via Compfight cc

Update: Apr 2014 – Since this is the most popular post on my site, I thougth I would save you all some time. For those who aren’t reading the details of this post and skipping straight to the code, please at least read this:

  1. This problem only applies to those running mySql 5.6 or later with Magento 1.8 or earlier.
  2. There are several triggers in the install code that can prevent installation. This is just one of them that I encountered.
  3. The Magento team have fixed this for the Magento 2 release.
  4. If you still need to fix something broken, consider hiring me or look for more Magento help here


Update: Nov 7, 2013 – I just received an email indicating that the fix to this issue is in review.

Installing Magento has been an uphill battle. Even the simple things are a pain. When installing most applications that have file permission requirements, you get a list of what needs to be changed. Magento doles them out two at a time. It’s not a big deal, I guess. It just feels like more roadblocks during installation.

But there are bigger issues than that. Installation halts for me with the message, “Database server does not support the InnoDB storage engine.” Now…I know that my db server is using InnoDB. I installed it myself, and set InnoDB as default. And when I run the query ‘show variables;’ it’s there: ‘storage_engine => InnoDB.’

But that’s not what the Magento install script is looking for. When I dug around into the installation files, I found that the Magento code is checking for the ‘have_innodb’ value. If you’re running an older version of MySQL, this isn’t an issue. But as of version 5.6, the ‘have_innodb’ value is deprecated. That version was released two years ago!

What’s even more irritating is that someone submitted a solution to this issue to the Magento GitHub six months ago. Even an exhaustive review of this code and a merge into the distribution would only take an hour or so. It’s a no-brainer.

But, I suppose, when your Enterprise version runs north of $15K yearly, there’s not as much emphasis put on the community edition. I understand that business model, and I’m glad there’s even a community edition offered. But for small businesses, the cost is prohibitive. And with installation issues like this, only techies are going to get around it.

If you’re tech-savy, it’s a quick fix. And if you’re not, you can still do it if you can open a file, cut and paste.

The file in question is located at the path below from your installation home. Open it in a text editor.


At the end of the file, you’ll find the function supportEngine(). Replace its contents with this:

public function supportEngine() {
    $engines  = $this->_getConnection()
        ->fetchPairs('SHOW ENGINES');
    return (isset($engines['InnoDB']) && $engines['InnoDB'] != 'NO' && $engines['InnoDB'] != 'DISABLED');

Assuming that your MySQL installation does indeed support the InnoDB storage engine, this will move you forward in the installation process.

Did you find this helpful? Not quite what you wanted? Flat-out wrong? Please let me know in the comments below.



Comments (8)

Not working :'(

The fix I wrote about worked for me, but maybe your install is breaking at a different point. You didn’t leave much information to work with. 🙂 Are you still working through it, or did you figure out the issue?

the solution you give its not working man

Rohit, thanks for leaving a comment. There are several reasons for a db connection error to be thrown. It could be that you’re having an issue at some other point in the install process. This fixed the issue for me, anyway.

Dear Friend,
I’ve solved this issue by flolwing step:
1. Create user , make sure that it will be connected to DB
2. Create empty database that using in step 0ne
That ‘s all
Good look

Thank you very much Jeff – your code solved my connection problem … have a great day!

Glad to hear it helped you, Antwone. Thanks for leaving a note!

I m new to magento ,recently I started installing magento 1.9 .I have installed the sample data too .But when it comes on the configuration panel its always says database connection error. I m using xampp. Please guide…

Leave a comment