• ioclaudio

    (@ioclaudio)


    Hi,

    in a CI script, when I use this command:

    wp db query "SELECT COUNT(*) FROM ${WORDPRESS_TABLE_PREFIX}users" --allow-root --skip-column-names

    I get the following error if the server doesn’t support SSL:

    Error: Failed to get current SQL modes. Reason: ERROR 2026 (HY000): TLS/SSL error: SSL is required, but the server does not support it

    I would like to use this command in both scenarios: when the server supports SSL and when it does not.

    I’ve tried the following approaches, but none of them work:

    • Using wp db query with the flag --ssl-mode=DISABLED.
    • Adding to wp-config.php the values:
    define('DB_SSL', false);
    define('MYSQL_CLIENT_FLAGS', 0);

    Adding the following to the MariaDB client configuration:

    [client-mariadb]
    disable-ssl-verify-server-cert

    <span style=”font-size: inherit;”>I am using a Docker container for WordPress: </span><code data-start=”957″ data-end=”973″>php:8.2-apache<span style=”font-size: inherit;”> with WP-CLI and </span><code data-start=”990″ data-end=”1006″>mariadb-client<span style=”font-size: inherit;”> installed.</span>

    The following command works:

    <span style="font-size: inherit;"> wp db check --allow-root --path="$WP_CORE_PATH" --skip-ssl </span>

    Is there a way to enable and disable the use of SSL using wp cli ?

    Thank you

    Claudio

Viewing 1 replies (of 1 total)
  • Moderator threadi

    (@threadi)

    There is no such constant as DB_SSL in WordPress. I think the decisive factor for the connection is the port you specified in DB_HOST. Does it differ from the default port 3306? If so, why? Is that the default setting of your host?

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.