MySQL error 3159: Insecure transport prohibited
The server has require_secure_transport turned on and the client connected without TLS. Connect with TLS or a local socket.
- Error number
3159- Name
ER_SECURE_TRANSPORT_REQUIRED- SQLSTATE
HY000- Category
- Connection and client
What it means
With require_secure_transport = ON, MySQL accepts only connections using TLS, a Unix socket or shared memory. A plain TCP connection is accepted at the network level but rejected at login with 3159. Many managed MySQL services turn this on by default.
Common causes
- A client or driver with TLS disabled (
--ssl-mode=DISABLED,useSSL=false). - An old client that doesn't negotiate TLS.
- Connecting through a tool configured to never use TLS.
How to fix it
-
Enable TLS in the client, for example
mysql --ssl-mode=REQUIRED -h db.example.com -u app -p, or your driver's TLS option. -
If you control the server and the network is trusted, you can turn the requirement off.
SET PERSIST require_secure_transport = OFF;
Related errors
More connection and client errors
2002Can't connect through socket2003Can't connect to MySQL server on host2005Unknown MySQL server host2006MySQL server has gone away2013Lost connection to MySQL server during query2055Lost connection to MySQL server at stage2059Authentication plugin cannot be loaded2061Authentication plugin reported error
The code and message text are from the MySQL 8.4 Error Message Reference. Browse the full MySQL error list or search every database error.
Work on MySQL in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for MySQL and the other databases you use.