How to Fix MySQL Error 3159 (ER_SECURE_TRANSPORT_REQUIRED)

Published
Length
3 min read

Luis Felipe Dias

All posts

You see mysql error 3159 when a client tries to log in without encryption. You can fix it by turning on TLS in your client settings or using a local socket. Database servers block plain text traffic when the secure transport rule is active. The server returns SQLSTATE HY000 and stops the login attempt right away. This rule keeps passwords and data safe as they move across the network. Teams often hit this roadblock after a server upgrade or a security audit. What causes mysql error 3159 in yo

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You see mysql error 3159 when a client tries to log in without encryption. You can fix it by turning on TLS in your client settings or using a local socket.

Database servers block plain text traffic when the secure transport rule is active. The server returns SQLSTATE HY000 and stops the login attempt right away. This rule keeps passwords and data safe as they move across the network. Teams often hit this roadblock after a server upgrade or a security audit.

What causes mysql error 3159 in your database

The server throws the ER_SECURE_TRANSPORT_REQUIRED message when a client skips transport encryption. When the server requires secure transport, it only accepts safe channels. A safe channel means TLS encryption, a Unix socket, or shared memory. Standard TCP network links without TLS will fail every single time.

Several common habits trigger this problem in daily work. An older app might use an outdated driver that defaults to plain text. A developer might run a quick script from a laptop without setting up certificate paths. Sometimes a load balancer strips TLS before the traffic reaches the database host. In each case, the database sees an unencrypted TCP link and rejects it.

How to diagnose and fix the failure in production

First, check how your app or tool connects to the database host. Look at the client logs to see where the login fails. Confirm if the client sits on the same machine or connects over a network. If the client runs on the same host, switch it from TCP to a local Unix socket. Local sockets count as secure transport and need no certificates.

For network traffic, you must turn on TLS in the client driver. Obtain the root certificate file from your database team or cloud provider. Point your app settings to this certificate file and set the driver to require encryption. Test the new setup in a staging system before you change production apps.

VNC Secure Access + MySQL Access Governance: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Never fix this error by turning off the secure transport rule on the server. Dropping encryption in production exposes login keys and query results to network sniffers. Also, do not grant broad network privileges to bypass the check. Keep the server rule strict and upgrade the client links instead.

How to prevent transport errors across your team

Human users also hit this error when they connect with desktop database tools. Every engineer must download the right certificates and set up their local client. When certificates expire or rotate, every person has to update their local files again. This manual work takes time and causes failed logins across the team.

A better path is to centralize how engineers and apps reach the database. When traffic flows through a central point, you manage TLS settings in one place. The central system handles the encrypted link to the database host for every session. Engineers log in with their normal work accounts and do not need local certificate files. You can also add data masking to rewrite emails, phone numbers, or card numbers in query results.

Add wire guardrails and masking beside MySQL

Database grants and TLS setup decide who can reach MySQL. Even so, an open session can run broad updates or read raw personal data from allowed tables. In practice, hoop.dev sits inline in the wire protocol beside the database as a sidecar for your MySQL. On every production query an agent or engineer sends, hoop.dev decides to pass, mask, block, or escalate it for human review.

With hoop.dev MySQL support, guardrails refuse bad queries before they run or hold risky calls for approval, while data masking rewrites matched sensitive values in result rows in memory. Furthermore, hoop.dev holds SOC 2 Type II and generates evidence for GDPR, HIPAA, and PCI DSS programs. Read the docs and source on GitHub.

Frequently asked questions

What does ER_SECURE_TRANSPORT_REQUIRED mean in MySQL?

This symbol means the server requires encrypted traffic for all logins. The database rejects your session because your client tried to use an unencrypted link.

Can I fix mysql error 3159 without using SSL certificates?

Yes, if your client runs on the exact same machine as the database. You can use a local Unix socket or shared memory instead of TCP.

Is it safe to turn off the secure transport setting on the server?

No, turning off this rule lets clients send passwords and data in plain text. Always fix the client to use TLS instead of weakening the server.

The query runs. The emails stay hidden.