When installing Magento, you may see the error “Database server does not support the innodb storage engine”. In this quick tutorial for developer, we will learn how to fix this issue for Magento 1.7 and Magento 1.9 (downloader) installation so that you can continue your installation flawlessly.
Troubleshooter
When you see this error, normally it’s caused by incompatible MYSQL version on your server. This error is mostly occured when you install Magento version 1.7 on a server running on MySQL 5.6.
You will see this error on Configuration step during installation, it looks like this
Even if your MySQL server supports Innodb (check it by using this command in Magento CLI)
1 | mysql> SHOW ENGINES; |
You still see this error, so what can we do to get rid of this error?
Soulution
Method 1
If you don’t want to override corefile of Magento, just downgrade MySQL 5.6 to 5.5 and the error will be gone, follow this detailed instruction to downgrade MySQL version
https://dev.mysql.com/doc/refman/5.6/en/downgrading.html
Method 2
We can also trickly bypass this error, open Mysql4.php file located in app/code/core/Mage/Install/Model/Installer/Db/Mysql4.php and find the following lines
1 2 3 4 5 6 | public function supportEngine() { $variables = $this->_getConnection() ->fetchPairs('SHOW VARIABLES'); return (!isset($variables['have_innodb']) || $variables['have_innodb'] != 'YES') ? false : true; } |
And replace with the following lines
1 2 3 4 5 6 | public function supportEngine() { $variables = $this->_getConnection() ->fetchPairs('SHOW ENGINES'); return (isset($variables['InnoDB']) && $variables['InnoDB'] != 'NO'); } |
As you can see, we replace SHOW VARIABLES with SHOW ENGINES and have_innodb with InnoDB
We can also just commend Innodb check function to by pass this step, as below
1 2 3 4 5 6 7 8 9 10 11 12 | /** * Check InnoDB support * * @return bool public function supportEngine() { $variables = $this->_getConnection() ->fetchPairs('SHOW ENGINES'); return isset($variables['InnoDB']) && ($variables['InnoDB'] == 'DEFAULT' || $variables['InnoDB'] == 'YES'); } */ |
Method 3
For Magento 1.7 running on Mysql5, we can also bypass that Magento error by using these lines
1 2 3 4 5 6 7 8 9 10 | public function supportEngine() { $variables = $this->_getConnection() ->fetchPairs('SHOW VARIABLES'); if (substr($variables['version'], 0, 3) == '5.6') { return true; } return (!isset($variables['have_innodb']) || $variables['have_innodb'] != 'YES') ? false : true; } |
The added line is if (substr($variables['version'], 0, 3) == '5.6') { which will tell the function to return true if Mysql version is 5.6.
Refresh the installation step and the error message is completely gone
Fix this issue in downloader for Magento 1.9
The issue was fixed in Magento 1.8 but somehow it appears again in Magento 1.9 if you use downloader to install Magento. We can also use the method above to fix this, replace your code in downloader.php with the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /** * Check availabe InnoDB on database. * * @return Magento_Downloader_Validator */ protected function _checkDbInnoDb() { if (!$this->_connection) { return $this; } $result = $this->_connection->query('SHOW ENGINES'); while($row = $result->fetch()){ if($row["Engine"] == "InnoDB" && $row["Support"] != "NO"){ $this->addMessage('Database server supports InnoDB storage engine'); return $this; } } $this->addError('Database server does not support InnoDB storage engine'); return $this; } |
Hope this helps
Feel free to let me know if you still see the error after trying all the methods above.
1 Comment
Thanks!