Skip to main content

Fixed: "ERROR 2026 (HY000): SSL connection error" with "tlsv1 alert protocol version" in MySQL

· 4 min read
Jagdish Kumawat
Founder @ Dewiride

tlsv1 alert protocol version is the server telling the client that it won't use that TLS version. The two have nothing in common, and the fix is to find what each allows.

What I Was Doing​

I'd set a MySQL 9.7 server to accept only TLS 1.3, and tried connecting with the mysql client, asking for TLS 1.2:

Terminal
docker compose exec mysql mysql --user=inventory_app --password --protocol=TCP --host=127.0.0.1 --tls-version=TLSv1.2 --execute "SELECT 1"

What I Expected​

For this test, a refusal. If you've landed here, either someone tightened the server's setting, or your client has an old list.

What I Got​

Output
ERROR 2026 (HY000): SSL connection error: error:0A00042E:SSL routines::tlsv1 alert protocol version

The mysql client stopping with ERROR 2026 (HY000): SSL connection error: error:0A00042E routines::tlsv1 alert protocol version.

What I Checked​

What the server allows, in a session over the local socket, which needs no TLS:

mysql>
SHOW VARIABLES LIKE 'tls_version';
Output
+---------------+---------+
| Variable_name | Value |
+---------------+---------+
| tls_version | TLSv1.3 |
+---------------+---------+
1 row in set (0.001 sec)

What the client asked for: only TLS 1.2. Those two lists don't overlap.

Why It Happens​

The client offers its versions at the start of the handshake. If the server can't accept any, it sends this alert. tlsv1 here is only part of the alert's name, and doesn't mean TLS 1.0.

The Fix​

Use a version from the server's list. For the mysql client, that means removing --tls-version, or naming one the server allows:

Terminal
docker compose exec mysql mysql --user=inventory_app --password --protocol=TCP --host=127.0.0.1 --tls-version=TLSv1.3 --table --execute "SHOW SESSION STATUS LIKE 'Ssl_version'"

For an older client that can't do TLS 1.3, widen the server's list instead:

mysql>
SET PERSIST tls_version = 'TLSv1.2,TLSv1.3';
ALTER INSTANCE RELOAD TLS;

After the Fix​

Output
+---------------+---------+
| Variable_name | Value |
+---------------+---------+
| Ssl_version | TLSv1.3 |
+---------------+---------+

SET PERSIST allowing TLS 1.2 and 1.3 again, ALTER INSTANCE RELOAD TLS, and a connection showing Ssl_version TLSv1.3.

Common Mistakes​

MistakeWhat happensDo this instead
Reading tlsv1 as TLS 1.0You look for a problem that isn't thereRead it as the alert's name
Turning TLS off to get inIt may be refused too, and it's unencryptedFind a common version
Changing the server's list and not reloadingThe old list stays in forceRun ALTER INSTANCE RELOAD TLS

Troubleshooting​

SymptomLikely causeFix
From .NET: Cannot determine the frame size…The same mismatchThe fix
ERROR 3159The server wants TLS, and the client has noneThe fix
tls_version says both, and it's still refusedThe server hasn't reloadedCheck Current_tls_version

Conclusion​

This alert means no TLS version in common. Compare tls_version on the server with what your client asks for, and use one on both lists.

Additional Resources​

Stay Updated

Subscribe to our newsletter for the latest tutorials, tech insights, and developer news.

By subscribing, you agree to our privacy policy. Unsubscribe at any time.