markshust / docker-magento

Mark Shust's Docker Configuration for Magento
https://m.academy/courses/set-up-magento-2-development-environment-docker/
MIT License
2.54k stars 997 forks source link

Error! Running Magento 2.4.4 with MySQL 8.0. #1144

Closed GNUXDAR closed 5 months ago

GNUXDAR commented 5 months ago

Description

I'm trying to install an existing project with version 2.4.4. I changed the PHP version to 8.1, commented out OpenSearch, uncommented Elasticsearch 7.16-0, and switched from MariaDB to MySQL 8.0. However, MySQL is throwing an error.

Steps To Reproduce

  1. I changed the PHP version to 8.1
  2. commented out OpenSearch
  3. uncommented Elasticsearch
  4. i changed the elasticsearch version to 7.16-0
  5. i switched from MariaDB to MySQL 8.0
  6. compose.healthcheck.yaml
  7. i comment opensearch and uncommented elasticsearch

compose.yaml image

compose.healthcheck.yaml image

Expected Result SUCCESS

Actual Result

image

bin/docker-stats image

I deleted all the containers and images and recreated them, but I'm getting the same result.

The log of MySql Container: `docker logs --tail 1000 -f 532e4c4355ef631d9d7f04c5fee10dd319bebb496a3ef0da855ba7054713838c

2024-04-28 04:42:41+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.36-1.el8 started. 2024-04-28 04:42:41+00:00 [ERROR] [Entrypoint]: mysqld failed while attempting to check config command was: mysqld --max_allowed_packet=64M --optimizer_use_condition_selectivity=1 --optimizer_switch=rowid_filter=off --verbose --help --log-bin-index=/tmp/tmp.EMup0KA9Ux 2024-04-28T04:42:41.262383Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead. 2024-04-28T04:42:41.262408Z 0 [ERROR] [MY-000077] [Server] /usr/sbin/mysqld: Error while setting value 'rowid_filter=off' to 'optimizer_switch'. 2024-04-28T04:42:41.264278Z 0 [ERROR] [MY-010119] [Server] Aborting`

YevhenZvieriev commented 5 months ago

Hi, @GNUXDAR

According to your logs, the problem is due to --optimizer_switch="rowid_filter=off" of the db image in the compose.yaml file, this option is no longer supported in MySQL 8.0.

Can you comment out or remove it?

GNUXDAR commented 5 months ago

Hello, good morning. Do you want me to comment out that line?

only --optimizer_switch="rowid_filter=off" ?

After commenting out the line you mentioned, it's still failing. Here's the log:

docker logs --tail 1000 -f 47629fbda8acb1fd264b17565f210045f6b70ff00e85e878e89c3447ddcd243e

2024-04-28 14:51:48+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.36-1.el8 started. 2024-04-28 14:51:48+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' 2024-04-28 14:51:48+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.36-1.el8 started. '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock' 2024-04-28T14:51:48.755330Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead. 2024-04-28T14:51:48.757046Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.36) starting as process 1 2024-04-28T14:51:48.762267Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: d740221b-056e-11ef-93dd-0242c0a81005. 2024-04-28T14:51:48.768931Z 1 [System] [MY-011012] [Server] Starting upgrade of data directory. 2024-04-28T14:51:48.768969Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2024-04-28T14:51:48.979582Z 1 [ERROR] [MY-012224] [InnoDB] Tablespace flags are invalid in datafile: ./ibdata1, Space ID:0, Flags: 21. Please refer to http://dev.mysql.com/doc/refman/8.0/en/innodb-troubleshooting-datadict.html for how to resolve the issue. 2024-04-28T14:51:48.979628Z 1 [ERROR] [MY-012237] [InnoDB] Corrupted page [page id: space=0, page number=0] of datafile './ibdata1' could not be found in the doublewrite buffer. 2024-04-28T14:51:48.979644Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Data structure corruption. 2024-04-28T14:51:49.478376Z 1 [ERROR] [MY-011013] [Server] Failed to initialize DD Storage Engine. 2024-04-28T14:51:49.479206Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed. 2024-04-28T14:51:49.479247Z 0 [ERROR] [MY-010119] [Server] Aborting 2024-04-28T14:51:49.479815Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.36) MySQL Community Server - GPL.

GNUXDAR commented 5 months ago

I was able to solve it as follows. By passing the version of MariaDB I had installed to Magento, in the file src/app/etc/di.xml, changing the MariaDB version:

<type name="Magento\Framework\DB\Adapter\SqlVersionProvider">
    <arguments>
        <argument name="supportedVersionPatterns" xsi:type="array">
            <item name="MySQL-8" xsi:type="string">^8\.0\.</item>
            <item name="MySQL-5.7" xsi:type="string">^5\.7\.</item>
            <item name="MariaDB-(10.2-10.4)" xsi:type="string">^10\.[2-4]\.</item>
        </argument>
    </arguments>
</type>

to

<item name="MariaDB-(10.2-10.6)" xsi:type="string">^10\.[2-6]\.</item>

And in the file src/vendor/magento/framework/Test/Unit/DB/Adapter/SqlVersionProviderTest.php, I also changed:

public function executeDataProvider(): array
{
    return [
        'MariaDB-10.4' => [
            ['version' => '10.4.12-MariaDB-1:10.4.12+maria~bionic'],
            '10.4.'
        ],

to

'MariaDB-10.6' => [
    ['version' => '10.6.17-MariaDB-1:10.6.17+maria~bionic'],
    '10.6.'