Home » WP-CLI » SSL Is Required, but the Server Does Not Support It: WP-CLI Fix

SSL Is Required, but the Server Does Not Support It: WP-CLI Fix

You run wp db export, wp db query or wp db import and WP-CLI stops before it does anything:

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

The website itself loads fine. Only the WP-CLI database commands fail, and so do the backup scripts, CI pipelines and deploy jobs that use them.

This is not a WordPress bug and your database is not broken. The MariaDB command-line client changed its defaults, and WP-CLI calls that client under the hood.


The wp db commands do not talk to the database through PHP. They run the mysql/mariadb and mysqldump/mariadb-dump binaries installed on the machine, with the credentials from wp-config.php.

Starting with MariaDB 11.4, that client turns on TLS with full server certificate verification by default. This is MariaDB’s zero-configuration SSL change, which shipped in 11.4.1.

If the database server on the other end has TLS turned off, the client refuses to fall back to a plain connection, and you get ERROR 2026. A typical case is an older MariaDB, or MySQL with SSL disabled. WordPress keeps working because PHP’s mysqli does not use those client defaults.

You usually hit it after one of these:

  • an OS upgrade that pulled in a newer mariadb-client package
  • a Docker or CI image rebuilt on a newer base, with mariadb-client installed next to WP-CLI
  • moving the database to a separate server or a managed service that has TLS off

Check which client you have:

mariadb --version
mysql --version

If the version string shows a MariaDB 11.4 or newer client, this is your cause.


The quick fix is to tell the client not to use TLS for this connection. The wp db commands pass extra flags straight through to mysql and mysqldump (see the wp db export docs), so add --skip-ssl to the command:

wp db check --skip-ssl
wp db export backup.sql --skip-ssl
wp db query "SELECT COUNT(*) FROM wp_users" --skip-ssl

wp db check should now print the table check results instead of ERROR 2026.

💡 Replace wp_ with your table prefix in the query.

If you run WP-CLI as root inside a container, keep your usual --allow-root and --path flags. --skip-ssl just goes next to them.

Only skip TLS when the database is on the same host, or on a private network you trust. Over the public internet you want encryption, so go to Step 3 instead.

The usual way to change MySQL client defaults is a [client] or [client-mariadb] section in ~/.my.cnf. For WP-CLI that often does nothing here.

The reason is in wp-cli/db-command issue #278. Before running your query, WP-CLI checks the current SQL modes, and that internal check runs the client with --no-defaults. Option files are ignored, and extra flags were not forwarded to that check either.

People who tried disable-ssl-verify-server-cert in the config file, --ssl-mode=DISABLED, or a DB_SSL constant in wp-config.php still got the error. WordPress has no DB_SSL constant, so that one never does anything.

If you need the flag in every script, wrap the command in a small shell function instead:

wpdb() {
  wp db "$@" --skip-ssl
}

wpdb export /backups/site-$(date +%F).sql

As of 2026-11-27, the WP-CLI team has merged changes for this in the db-command package. That includes PR #334, which passes --skip-ssl-verify-server-cert on MariaDB, and a commit that drops the SQL mode probe. Run wp cli update, and keep the flag in your scripts until a stable release handles your setup without it.

wp cli update
wp cli version

If you installed WP-CLI as a Phar and can’t wait, wp cli update --nightly moves you to the latest build of the main branch. The docs call it “potentially unstable”, so I would not do that on a production box just for this.

See also  Briefly Unavailable for Scheduled Maintenance: WordPress Fix

The clean fix is on the server side. If the server supports TLS, the new client defaults just work, and the connection is encrypted too.

Check what the server reports, using the flag from Step 1 so the query can run at all:

wp db query "SHOW VARIABLES LIKE 'have_ssl'" --skip-ssl

DISABLED means the server can do TLS but has no certificate configured. NO means it was built without TLS support. Either way, the client is telling the truth.

On a server you control, you have two options:

  • upgrade the server to MariaDB 11.4 or newer, which generates its own certificate and enables TLS without extra configuration
  • configure ssl_cert, ssl_key and ssl_ca in the server’s [mysqld] section and restart it

Back up the database before a server upgrade. wp db export backup.sql --skip-ssl from Step 1 works for that.

After that, run wp db check without any flag. If you now get a certificate error instead, such as self-signed certificate in certificate chain, the server has TLS but the client cannot verify its certificate. Pass --skip-ssl-verify-server-cert on a trusted network, or give the client the server’s CA file.

On shared or managed hosting you can’t change the server config. Ask the host to enable TLS on the database server, and use --skip-ssl until they do.

In OpenPanel, each account runs its own database service, and you can pick MySQL, MariaDB or Percona under Switch Database Server. Switching deletes all databases and database users, so export everything first. On cPanel the database server is one install for the whole server, chosen by the admin, so as a user you can only ask your host.


This error tends to show up in cron jobs and CI, where nobody sees it until a backup is missing. Make sure the script fails loudly:

#!/bin/sh
set -e
FILE=/backups/site-$(date +%F).sql
wp db export "$FILE" --skip-ssl --path=/var/www/html
test -s "$FILE"

set -e stops the script on the first error, and test -s fails if the dump file is missing or empty. Hook the exit code into whatever alerting you already use.

If your backup plugin is what hangs on the database step, I covered the WP-CLI route in WordPress Backup Stuck on the Database? Export It With WP-CLI. If the website also cannot reach the database, that is a different problem: see Error Establishing a Database Connection in WordPress. More WP-CLI fixes are in my list of common WP-CLI errors.

TL;DR: ERROR 2026 “SSL is required, but the server does not support it” comes from the MariaDB 11.4+ client, which enables TLS by default, talking to a database server with TLS off. Add --skip-ssl to your wp db commands for a local or private database, keep WP-CLI updated, and enable TLS on the database server for the real fix.

Was this post helpful?

Leave a Comment

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.

Recommended