MySQL database setup fails when setting up an Atlassian application

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

When going over the application's setup wizard, you may see the error "Could not connect to the database: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up." when connecting to a MySQL database.

Environment

Any Atlassian application

MySQL database

Diagnosis

You will see the following error logged in the catalina logs:

1 2 3 4 5 6 2021-05-10 09:22:38,388 http-nio-80-exec-4 ERROR [console.action.setup.Database] Unable to connect to database: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up. com.atlassian.config.bootstrap.BootstrapException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up. .... Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure ...... Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)

Cause

Notice this specific cause:

1 Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)

This error stems from the fact that recent Oracle Java versions and OpenJDK versions have disabled TLS 1.0 and 1.1 protocols

Affected Versions:

Oracle JDK: 8u291 and newer

OpenJDK 8: 8u292 and newer

OpenJDK 11: 11.0.11 and newer

Solution

There are two options to resolve this error:

  • Append the following in your JDBC connection URL -

    1 enabledTLSProtocols=TLSv1.2

    in order for MySQL to use the more secured protocol as the affected JAVA version, by default, disables anything lower than TLSv1.2.

    You can also verify first whether your MySQL database supports TLSv1.2 before making the above change:

    1 SHOW GLOBAL VARIABLES LIKE 'tls_version';
  • You can make JAVA accept the TLSv1.0 and TLSv1.1 protocol by going to your $JAVA_HOME/lib/security/java.security and remove them from the following parameter (you can either comment it out or remove those protocols from the list) -

    1 2 jdk.tls.disabledAlgorithms=SSLv3, TLSv1, RC4, DES, MD5withRSA, DH keySize < 1024, \ EC keySize < 224, 3DES_EDE_CBC, anon, NULL

The second option is only recommended if the first one is not possible as you end up enabling the weak algorithms.

Updated on March 18, 2025

Still need help?

The Atlassian Community is here for you.