Skip to content

Upgrading MODX when using a custom MySQL port fails. #15027

Open
@muzzwood

Description

@muzzwood

Bug report

Summary

I have a MODX site with a custom MySQL port in the DSN string in the config.inc.php file.
When upgrading to 2.7.3 and running setup it strips the port from the DSN string, then the connection to the database times out so the setup fails.

I was able to complete setup in the end by choosing to edit the current database details in the setup and adding the port to the end of the host field. e.g. myhost:20111

Perhaps there should be a MySQL port option here?

Ultimately the main issue is I think the current port in the config file should be respected when upgrading with current db details.

Step to reproduce

Add a port to the DSN string in the config.inc.php file. e.g. $dsn = 'mysql:host=localhost;dbname=test;port=3306;charset=utf8mb4';
Run setup when upgrading. Select upgrade with current details, see the page with all the checks then click install. Now check the config.inc.php file and the port has been removed.

Observed behavior

Setup fails as it can't connect to the database.

Expected behavior

The port should not be stripped from the DSN. Or there should be a port variable in the config.inc.php file so it can be included in the DSN automatically.

Environment

MODX 2.7.2 -> 2.7.3, Nginx PHP 7.4, MySQL 8.

Metadata

Metadata

Assignees

Labels

area-setupbugThe issue in the code or project, which should be addressed.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions