magento 安裝時 Database server does not support the InnoDB storage engine 的解決辦法
阿新 • • 發佈:2021-07-09
magento 安裝時 Database server does not support the InnoDB storage engine 的解決辦法
開啟app\code\core\Mage\Install\Model\Installer\Db\Mysql4.php檔案,編輯supportEngine方法,在原方法中的return前新增以下程式碼:- if (!isset($variables['have_innodb'])) {
-
$engines = $this->_getConnection()->fetchPairs('SHOW ENGINES');
- return (isset($engines['InnoDB']) && ($engines['InnoDB'] == 'DEFAULT' || $engines['InnoDB'] == 'YES'));
- }
報錯的原因是因為Mysql 5.6版本已經已經丟棄了“have_innodb”這個函式.而Magento1.7.0.2以下,都是使用該函式檢測Mysql是否激活了InnodB引擎。
================= 測試如下 ===================================
public function supportEngine()
{
$variables = $this->_getConnection()
->fetchPairs('SHOW VARIABLES');
if (!isset($variables['have_innodb'])) {
$engines = $this->_getConnection()->fetchPairs('SHOW ENGINES');
return (isset($engines['InnoDB']) && ($engines['InnoDB'] == 'DEFAULT' || $engines['InnoDB'] == 'YES'));
}
return (!isset($variables['have_innodb']) || $variables['have_innodb'] != 'YES') ? false : true;
}