• Resolved Ju’Z[ed]

    (@juzed)


    Hi everyone,

    I’m encountering an issue when running the wp search-replace command.

    Here’s what’s happening:

    Command:

    wp search-replace --allow-root --recurse-objects --all-tables --precise "oldurl" "newurl"

    Error:

    Got error: 2026: TLS/SSL error: SSL is required, but the server does not support

    Environment:

    • WordPress: 6.8.3
    • PHP: 8.3.27
    • MariaDB: 11.8.3No SSL configured
    • MariaDB Client: 15.2
    • WP-CLI: 2.12.0
    • OS: debian-linux-gnu (x86_64) (Docker)

    Same error on:

    wp db check

    No error on:

    wp db check --ssl=false

    Observations:

    • The issue only occurs on PHP 8.2.29+ . Downgrading to PHP 8.2.28 resolves it.
    • No custom database configurations in wp-config.php other than credentials.
    • No plugins are active during testing.

    Question:

    Why does wp search-replace fail? Is there a known issue or MYSQL_CLIENT_FLAGS I should use in wp-config.php?

    Thank you for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator threadi

    (@threadi)

    The message is generated by components used by your hosting provider, presumably in relation to the MariaDB database system. It is difficult to determine why it appears. Interestingly, a previous version of PHP does not generate the error – there may be an error in the PHP library for the database connection, or your Linux distribution’s package manager may have overlooked something.

    It is also interesting that --ssl=false solves the problem. Perhaps you simply use this parameter in your environment in general.

    During a quick search, I also found this FAQ entry at Plesk: https://support.plesk.com/hc/en-us/articles/30110469952151-Backup-of-a-WordPress-instance-fails-in-WP-Toolkit-TLS-SSL-error-SSL-is-required-but-the-server-does-not-support-it – if you use Plesk, this might be interesting.

    Thread Starter Ju’Z[ed]

    (@juzed)

    Update on the issue:

    The error was actually occurring during wp db import db.sql, not during the search-and-replace step. The search-and-replace wasn’t working because the import itself was failing.

    What I tried:

    • Globally disabled SSL in the MySQL config by adding:
    [client]
    ssl=0

    (Not sure if this had any effect, though.)

    What likely fixed it:

    Adding the --defaults flag to the wp db commands, like so:

    wp db import db.sql --defaults

    This ensures the command reads the credentials from wp-config.php, whereas the default behavior (equivalent to --no-defaults) was causing mariadb-check to fail during the import process.

    • This reply was modified 3 weeks ago by Ju'Z[ed].
    Thread Starter Ju’Z[ed]

    (@juzed)

    Update on the issue:

    The error was occurring during wp db import db.sql, not during the search-and-replace step. The search-and-replace wasn’t working because the import itself was failing.

    What fixed it: Two things were critical:

    • Adding the --defaults flag to the wp db commands:
    wp db import db.sql --defaults
    • Disabling SSL in the MySQL configuration by adding:
    [client]
    ssl=0

    Removing this configuration caused the import to fail again, so it was also necessary.

    Thread Starter Ju’Z[ed]

    (@juzed)

    Erratum:

    Adding the --defaults flag to the wp db commands ensure that the command reads your MySQL configuration.

    By default, --no-defaults is used in wp db command, but I don’t know why this choice, it seems strange…

    • This reply was modified 2 weeks, 6 days ago by Ju'Z[ed].
Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.