Skip to content

DB-Check fails if Database requires SSL #113

@Iridias

Description

@Iridias

Bug Report

Describe the current, buggy behavior
Executing any config-command, that checks the database, e.g. wp config create will result in the following error, if the database requires SSL:
ERROR 9002 (28000): SSL connection is required. Please specify SSL options and retry.

Even if you specify:

--extra-php <<PHP
define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL);
PHP

...because the check is not using PHP, but rather:

// Check DB connection.
		if ( ! Utils\get_flag_value( $assoc_args, 'skip-check' ) ) {
			Utils\run_mysql_command( '/usr/bin/env mysql --no-defaults', $mysql_db_connection_args );
		}

(where mysql_db_connection_args is hardcoded)
and there is currently no way to specify/inject an addition parameter like --ssl!

Describe how other contributors can replicate this bug

Create a MySQL-DB that requires SSL (for Azure-MySQL there is button "Enforce SSL connection")
And then try wp config create with valid credentials.

Describe what you would expect as the correct outcome
Working MySQL-Connection.

Let us know what environment you are running this on
environment independent.

Provide a possible solution

Either respect the addition PHP define('MYSQL_CLIENT_FLAGS', MYSQLI_CLIENT_SSL); or provide a parameter to enable SSL!
wp db export seems to have such an option: wp-cli/db-command#126 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions