Skip to content

Setup:upgrade does not work with custom mysql port #4548

@pixelplant

Description

@pixelplant

Hello

There's a blocking issue when you use a custom mysql port and run php bin/magento setup:upgrade

The schema install/update part calls on the DbValidator's checkDatabaseConnection method which does not pass the custom mysql port defined in app/etc/env.php so the update schema will fail.
It only happens when Magento tries to call the "information_schema" database. The connection to the Magento database works fine.

The call is done in this file, https://github.com/magento/magento2/blob/develop/setup/src/Magento/Setup/Validator/DbValidator.php
in the method checkDatabaseConnection

As you can see, there is no port passed to the call so using a custom one will not work.

        // 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,
        ]);

Hardcoding the port directly in this call allowed us to proceed with the upgrade. The same issue is present in the Enterprise version of Magento (at least version 2.0.2 as I have not been able to upgrade yet).

Thanks,
Radu

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for development

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions