Skip to content

WP Config Create is broken with 2.9.0 if socks MySQL connectivity is being used  #169

@aonsyed

Description

@aonsyed

Bug Report

Describe the current, buggy behavior

Since 2.9.0 last night, wp config create doesn't work if --dbhost=localhost:/var/run/mysqld/mysqld.sock is used, there is no issues with with the sock or configuration and everything works correctly if the config is manually created, only the create command is not working

Describe how other contributors can replicate this bug

Make sure that your database server is set to listen to socks and TCP port. Run something like this

/usr/local/bin/wp config create --dbname=dbname --dbuser=dbuser --dbpass=somevalue --dbprefix=wp_ --url=site.com --dbhost=localhost:/var/run/mysqld/mysqld.sock --allow-root --skip-themes --skip-packages --skip-plugins --path=/var/www/site.com/htdocs

And it will give you this error and there won't be a file

Error: Database connection error (2002) Connection refused

Describe what you would expect as the correct outcome

However if you run this

/usr/local/bin/wp config create --dbname=dbname --dbuser=dbuser --dbpass=somevalue --dbprefix=wp_ --url=site.com --dbhost=localhost --allow-root --skip-themes --skip-packages --skip-plugins --path=/var/www/site.com/htdocs

If will show you success message and fix config file will be created

Let us know what environment you are running this on

Tested this on Ubuntu 18, 20, 22 with multiple versions of Percona and mariaDB, wp --info remains identical

Provide a possible solution

Rolling back to 2.8.1

Provide additional context/Screenshots

N/A

If applicable, add screenshots to help explain (you can just drag&drop images into the Github issue).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions