Azure Database for MySQL refuses a connection that does not use SSL
ERROR 3159 (HY000): Connections using insecure transport are prohibited while --require_secure_transport=ON.Short answer
Azure Database for MySQL Flexible Server requires encrypted connections by default (require_secure_transport = ON, TLS 1.2). A client that connects without SSL, or only offers TLS 1.0 or 1.1, is rejected. Turn SSL on in the client with the CA certificate, or, for a legacy app only, set require_secure_transport to OFF.
Fix it fast
1Find out which cause you have
Try the connection with SSL required and the Azure root certificate. If this works, only the client's SSL settings were missing.
wget https://cacerts.digicert.com/DigiCertGlobalRootG2.crt.pem mysql -h mydemoserver.mysql.database.azure.com -u myadmin -p --ssl-mode=REQUIRED --ssl-ca=DigiCertGlobalRootG2.crt.pem2Match what you see, then jump to its fix
- 1
ERROR 3159 on every connection from the app, and the connection string has no SSL option.The client connects without SSL while the server enforces itFix - 2
The app is old, its driver has no SSL option, and you cannot change it.A legacy application cannot use encrypted connectionsFix - 3
You rely on the default --ssl-mode and the certificate is not checked, or a script passes --ssl-mode=DISABLED.The mysql client's default mode does not verify or insist on SSLFix - 4
The connection fails during the TLS handshake instead of with error 3159.The client only speaks TLS 1.0 or 1.1Fix
- 1
What does the error look like?
ERROR 3159 (HY000): Connections using insecure transport are prohibited while --require_secure_transport=ON.
Cause 1 of 4
The client connects without SSL while the server enforces it
1Check
The server default is require_secure_transport = ON. From any client that can connect, read the current value.
SHOW GLOBAL VARIABLES LIKE 'require_secure_transport';2Fix
Add the SSL parameter your connector uses (for example useSSL=true, sslmode=required or ssl_verify_cert=true) and point it at the CA certificate. The Connection Strings page of the server in the Azure portal lists the right parameters per language.
# mysql client
mysql -h mydemoserver.mysql.database.azure.com -u myadmin -p --ssl-mode=REQUIRED --ssl-ca=DigiCertGlobalRootG2.crt.pem
# Java (Connector/J) URL
jdbc:mysql://mydemoserver.mysql.database.azure.com/quickstartdb?useSSL=true3Verify
Run status in the mysql client; the SSL line shows the cipher in use.
statusConfirmed by learn.microsoft.com
Cause 2 of 4
A legacy application cannot use encrypted connections
1Check
Microsoft documents turning off enforcement as the path for legacy clients that cannot encrypt. It is a dynamic parameter: it applies at once and needs no restart.
SHOW GLOBAL VARIABLES LIKE 'require_secure_transport';2Fix
In the Azure portal open the server, go to Server parameters, set require_secure_transport to OFF and save. The server then accepts encrypted and unencrypted connections. Treat this as temporary and plan to move the client to TLS.
-- Portal: Server parameters > require_secure_transport = OFF > Save3Verify
Connect with the old client.
SHOW GLOBAL VARIABLES LIKE 'require_secure_transport';Confirmed by learn.microsoft.com
Cause 3 of 4
The mysql client's default mode does not verify or insist on SSL
1Check
The mysql client defaults to PREFERRED, which encrypts if possible but falls back to plaintext. DISABLED never encrypts. Passing --ssl-ca without an explicit mode implies VERIFY_CA.
mysql --help | grep -i ssl-mode2Fix
Use REQUIRED to insist on encryption, or VERIFY_CA with the Azure root certificate to also check the server.
mysql -h mydemoserver.mysql.database.azure.com -u myadmin -p --ssl-mode=VERIFY_CA --ssl-ca=DigiCertGlobalRootG2.crt.pem3Verify
status shows the SSL cipher line.
statusConfirmed by dev.mysql.com
Cause 4 of 4
The client only speaks TLS 1.0 or 1.1
1Check
Flexible Server uses TLS 1.2 by default and denies TLS 1.0 and 1.1; Microsoft began a forced upgrade for servers on those versions on 31 August 2025. Read the configured protocols.
SHOW GLOBAL VARIABLES LIKE 'tls_version';2Fix
Update the client, connector or runtime to one that supports TLS 1.2. The documented options are TLS 1.2 (default) and TLS 1.3 (recommended, MySQL 8.0 and later). tls_version is a static parameter and needs a restart to change.
-- Portal: Server parameters > tls_version, then restart the server (static parameter)3Verify
Reconnect and run status; it shows the cipher in use when the connection is encrypted.
statusConfirmed by learn.microsoft.com
How do I stop it coming back?
- Keep require_secure_transport ON and fix clients instead of relaxing the server.
- Store the CA certificate with the app image or deployment so every environment connects the same way.
- Test new connectors against a staging server with enforcement on before they reach production.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- ShopGoAn e-commerce aggregator with a Python scraping engine behind its catalog, past 10K Google Play downloads.
Related fixes
Databases
Installing the Airflow MySQL provider fails on pkg-config or mysqlclient
Building the mysqlclient wheel fails during the install
The Airflow MySQL provider depends on mysqlclient, which pip compiles against the MySQL C client library.
2 causes, each with a fixDatabases
A query on Aurora MySQL dies with 'table /rdsdbdata/tmp/#sql... is full'
ERROR 1114 (HY000): The table '/rdsdbdata/tmp/#sqlfd_1586_2' is full
In Aurora MySQL 3, internal temporary tables share one pool, and when that pool and the memory-mapped overflow file are used up, a reader instance ends the query with error 1114.
3 causes, each with a fixDatabases
Compiling a C or C++ program that includes mysql.h fails
undefined reference to `mysql_init'
The compiler only finds mysql.h when the MySQL client development files are installed and their folder is on the include path.
3 causes, each with a fixDatabases
DBeaver fails to resolve Maven dependencies when downloading a database driver
A driver library does not download automatically
DBeaver downloads driver jars from a Maven repository.
3 causes, each with a fixDatabases
DBeaver cannot verify the MySQL server certificate
unable to find valid certification path to requested target
DBeaver's MySQL driver is checking the server certificate and Java does not trust the CA that signed it.
2 causes, each with a fixDatabases
Django cannot load MySQLdb and asks whether mysqlclient is installed
Error loading MySQLdb module: Did you install mysqlclient or MySQL-python?
Django's MySQL backend imports MySQLdb, which is provided by the mysqlclient package.
3 causes, each with a fix