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

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

この記事はアトラシアンのサーバー製品にのみ適用されます。クラウドとサーバー製品の違いについてはこちらをご確認ください。

問題

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

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.

原因

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

回避策

Add the useJDBCCompliantTimezoneShift=trueuseLegacyDatetimeCode=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:

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.

最終更新日 2016 年 9 月 15 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.