Database migration to MySQL fails - java.sql.SQLException: The server time zone value CDT is unrecognized or represents more than one time zone

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

Problem

When migrating to an external MySQL database you are presented with this error message:

1 2 Unable to connect to MySQL database jdbc:mysql://localhost:3306/<application>: java.sql.SQLException: The server time zone value 'CDT' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specific time zone value if you want to utilize time zone support. Couldn't connect to the database.

Cause

This is a bug affecting the mysql-connector-java from version 5.1.33 up to 5.1.37: http://bugs.mysql.com/bug.php?id=79343

Workaround

Add the useJDBCCompliantTimezoneShift=true, useLegacyDatetimeCode=false, and the serverTimezone=UTC to the jdbc url in the $BITBUCKET_HOME/shared/bitbucket.properties file. If this file doesn't exist, create it and ensure it looks similar to this:

1 2 3 4 5 jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/bitbucket?characterEncoding=utf8&useUnicode=true&sessionVariables=storage_engine%3DInnoDB&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC jdbc.user=<bitbucketuser> jdbc.password=<your_password_for_the_db>

Replace <bitbucketuser> with the user you set up for Bitbucket Server to access the database and <your_password_for_the_db> with the actual password the bitbucketuser uses to access the database.

If the error persists after a restart of the application, ensure you are using a more recent version of the connector, specifically 5.1.39.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.