Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Databases and Redis

Azure Database for MySQL refuses a connection that does not use SSL

ErrorERROR 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.

  • Applies to Azure Database for MySQL Flexible Server 8.0, mysql client 8.0
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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.pem
  2. 2Match what you see, then jump to its fix

    1. 1ERROR 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. 2The app is old, its driver has no SSL option, and you cannot change it.A legacy application cannot use encrypted connectionsFix
    3. 3You 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. 4The connection fails during the TLS handshake instead of with error 3159.The client only speaks TLS 1.0 or 1.1Fix

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=true

3Verify

Run status in the mysql client; the SSL line shows the cipher in use.

status

Confirmed by learn.microsoft.com

Did this fix it?

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 > Save

3Verify

Connect with the old client.

SHOW GLOBAL VARIABLES LIKE 'require_secure_transport';

Confirmed by learn.microsoft.com

Did this fix it?

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-mode

2Fix

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.pem

3Verify

status shows the SSL cipher line.

status

Confirmed by dev.mysql.com

Did this fix it?

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.

status

Confirmed by learn.microsoft.com

Did this fix it?

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:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.