magento2强制使用低版本MYSQL5.5的实操方法记录

作者:admi... 点击数: 0 收藏到会员中心
最后编辑时间: 2021-07-05 21:29

近日有一客户服务器想安装M2,但是整体数据库MYSQL版本为5.5.X,完全不符合安装条件。让我们想办法处理~

只到钱到位,一切都好办!!开搞

1。setup/src下有安装版本验证

setup/src/Magento/Setup/Controller/DatebaseCheck.php

中的indexAction需要修改为

  public function indexAction()
    {
       return new JsonModel(['success' => true]);
    }

2。

setup/src/Magento/Setup/Validator/DbValidator.php

中的大约98行修改为

    public function checkDatabaseConnection($dbName, $dbHost, $dbUser, $dbPass = '')
    {
        // establish connection to information_schema view to retrieve information about user and table privileges
        $connection = $this->connectionFactory->create([
            ConfigOptionsListConstants::KEY_NAME => 'information_schema',
            ConfigOptionsListConstants::KEY_HOST => $dbHost,
            ConfigOptionsListConstants::KEY_USER => $dbUser,
            ConfigOptionsListConstants::KEY_PASSWORD => $dbPass,
            ConfigOptionsListConstants::KEY_ACTIVE => true,
        ]);

     

        return $this->checkDatabaseName($connection, $dbName) && $this->checkDatabasePrivileges($connection, $dbName);
    }

为防止出现 提示

sorry,but we support MYSQL version 5.6.0 or later.


这些都是必须的,从其它正常安装的同版本中,得到一数据库,这里数据库有意思了


付费内容限时免费中...

M2中的数据库引擎大多数是INnodb,但是MYSQL5.5并不支持FULLTEXT类型及相关索引。

这里为保障不动MYSQL.ini配置,那么只能修改相关的数据库表

注意项1.

当建立的数据库表含有FullTEXT时, storage-engine只能为MYISAM,可正常运行。

修改示例,原SQL语句

DROP TABLE IF EXISTS `catalogsearch_fulltext_scope1`;
CREATE TABLE `catalogsearch_fulltext_scope1` (
  `entity_id` int(10) unsigned NOT NULL COMMENT 'Entity ID',
  `attribute_id` int(10) unsigned NOT NULL COMMENT 'Attribute_id',
  `data_index` longtext COMMENT 'Data index',
  PRIMARY KEY (`entity_id`,`attribute_id`),
  FULLTEXT KEY `FTI_FULLTEXT_DATA_INDEX` (`data_index`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='catalogsearch_fulltext_scope1_tmp';

修改为

DROP TABLE IF EXISTS `catalogsearch_fulltext_scope1`;
CREATE TABLE `catalogsearch_fulltext_scope1` (
  `entity_id` int(10) unsigned NOT NULL COMMENT 'Entity ID',
  `attribute_id` int(10) unsigned NOT NULL COMMENT 'Attribute_id',
  `data_index` longtext COMMENT 'Data index',
  PRIMARY KEY (`entity_id`,`attribute_id`),
  FULLTEXT KEY `FTI_FULLTEXT_DATA_INDEX` (`data_index`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='catalogsearch_fulltext_scope1_tmp';

注意项2.

MYSQL5.5并不支持

`update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0),

这样子的sql语句。

只能修改替换全部

 DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0)

 DEFAULT  '0000-00-00 00:00:00'

这样子就完成了数据库跨版本导入工作。


这时有可能会有另外一个问题,用户无法登录。

则参见文章解决,https://www.magentola.com/news-read-236.html  发现问题解决问题,多折腾是基本,加油,打工程序员~~


内容说明:
如您需要转载本文请保留以下信息是对作者发文的支持与尊重:

magento2强制使用低版本MYSQL5.5的实操方法记录 来源于 https://www.magentola.com/news-read-235.html
上一篇:M2.4.2-p1 dotmailer扩展出现错误Warning: implode(): Invalid arguments passed
下一篇:M2测试模式自动生成刷新静态文件,无需人工编译的解决方法
相关内容
产品推荐