php Magento 安装抱怨 InnoDB 可用时丢失

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15443448/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 09:14:21  来源:igfitidea点击:

Magento install complains about missing InnoDB when it is available

phpmysqlmagentoinnodb

提问by Giles Williams

During installation, Magento produces the following error:

在安装过程中,Magento 产生以下错误:

Database server does not support the InnoDB storage engine.

数据库服务器不支持 InnoDB 存储引擎。

I've fixed all the dependancies for Magento, and double checked with MySQL on the command line using SHOW ENGINES and definitely have InnoDB available (also the default storage engine).

我已经修复了 Magento 的所有依赖项,并在命令行上使用 SHOW ENGINES 对 MySQL 进行了双重检查,并且肯定有 InnoDB 可用(也是默认存储引擎)。

This isn't an issue about access to MySQL config which others might have seen on their install.

这不是访问 MySQL 配置的问题,其他人可能在他们的安装中看到过。

Note: This is running on a Mac Pro (with a simple hosts DNS rewrite for the domain name I am developing for).

注意:这是在 Mac Pro 上运行的(对我正在开发的域名进行了简单的主机 DNS 重写)。

回答by Michael Benjamin

Line 59 of the file app/code/core/Mage/Install/Model/Installer/Db/Mysql4.php

文件的第 59 行 app/code/core/Mage/Install/Model/Installer/Db/Mysql4.php

Replace:

代替:

public function supportEngine()
{
    $variables  = $this->_getConnection()
        ->fetchPairs('SHOW VARIABLES');
    return (!isset($variables['have_innodb']) || $variables['have_innodb'] != 'YES') ? false : true;
}

with this:

有了这个:

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

回答by Rokko_11

Or don't do a core-hack! You should override the Installer-Model softly before Installation:

或者不要做核心黑客!您应该在安装之前轻柔地覆盖安装程序模型:

Paste this in your app/code/local/Company/InstallBugfix/etc/config.xml:

将此粘贴到您的app/code/local/Company/InstallBugfix/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Company_InstallBugfix>
            <version>0.1.0</version>
        </Company_InstallBugfix>
    </modules>
    <global>
        <models>
            <installbugfix>
                <class>Company_InstallBugfix_Model</class>
            </installbugfix>
            <install>
                <rewrite>
                    <installer_db_mysql4>Company_InstallBugfix_Model_Installer_Db_Mysql4</installer_db_mysql4>
                </rewrite>
            </install>
        </models>
    </global>
</config>

And following in app/code/local/Company/InstallBugfix/Model/Installer/Db/Mysql4.php:

并在以下内容中app/code/local/Company/InstallBugfix/Model/Installer/Db/Mysql4.php

<?php
class Company_InstallBugfix_Model_Installer_Db_Mysql4 extends Mage_Install_Model_Installer_Db_Mysql4
{
    /**
     * Check InnoDB support
     *
     * @return bool
     */
    public function supportEngine()
    {
        $supportsEngine = parent::supportEngine();
        if ($supportsEngine) {
            return true;
        }
        $variables = $this
                     ->_getConnection()
                     ->fetchPairs('SHOW ENGINES');
        return (isset($variables['InnoDB']) && $variables['InnoDB'] != 'NO');
    }
}

And enable the extension. The advantage is, that the old validation is still correct, if the mysql-version is older.

并启用扩展。优点是,如果 mysql-version 较旧,旧的验证仍然正确。

回答by Luke

ver 1.9.1.0 downloader.php

版本 1.9.1.0 downloader.php

Putting this up for anyone thats using the downloader.phpcurrently bundled in the 1.9.1.0installer.

为使用downloader.php当前捆绑在1.9.1.0安装程序中的任何人提供此信息。

If you're happy that your MySQL Database does support InnoDB (It's the DEFAULT) in later versions. You can safely edit the file to remove the check and all the download to take place.

如果您很高兴您的 MySQL 数据库在更高版本中确实支持 InnoDB(这是默认值)。您可以安全地编辑文件以删除检查并进行所有下载。

    /**
     * Check availabe InnoDB on database.
     *
     * @return Magento_Downloader_Validator
     */
    protected function _checkDbInnoDb()
    {
        if (!$this->_connection) {
            return $this;
        }
        $this->addMessage('Database server supports InnoDB storage engine');
        return $this;
    }

回答by Rokko_11

Bug was fixed in Magento CE 1.8, so just use the lines above for CE \leq 1.7

Magento CE 1.8 中修复了错误,因此只需将上面的行用于 CE \leq 1.7

回答by anthony

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

回答by Magento

Line 59 of the file app/code/core/Mage/Install/Model/Installer/Db/Mysql4.php

文件 app/code/core/Mage/Install/Model/Installer/Db/Mysql4.php 的第 59 行

Replace:

代替:

public function supportEngine()
 {
    $variables  = $this->_getConnection()
        ->fetchPairs('SHOW VARIABLES');
    return (!isset($variables['have_innodb']) || $variables['have_innodb'] != 'YES') ? false : true;
}    

with this:

有了这个:

public function supportEngine()
{
 /*   
     $variables  = $this->_getConnection()
        ->fetchPairs('SHOW ENGINES');
     return (!isset($variables['have_innodb']) || $variables['have_innodb'] != 'YES') ? false : true; 
*/
    return 1;
}

回答by Wagner Maximiliano

I was having the same issue and the only way it worked was when I changed Line 59 of the file app/code/core/Mage/Install/Model/Installer/Db/Mysql4.phpfrom:

我遇到了同样的问题,它起作用的唯一方法是将文件app/code/core/Mage/Install/Model/Installer/Db/Mysql4.php 的第 59 行更改为:

public function supportEngine()
{
    $variables  = $this->_getConnection()
        ->fetchPairs('SHOW VARIABLES');
    return (!isset($variables['have_innodb']) || $variables['have_innodb'] != 'YES') ? false : true;
}

With:

和:

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

And I didn't find it anywhere so if you are struggling I guarantee this will solve it.

而且我没有在任何地方找到它,所以如果你在挣扎,我保证这会解决它。