Bitbucket fails to start with Unknown system variable 'query_cache_size' when connecting to MySQL v8+
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
要約
Whey trying to connect to a MySQL 8.0.11+ database, the connection fails.
When starting Bitbucket having upgraded MySQL to v8.0.11+, Bitbucket fails to start.
環境
MySQL v8.0.11+
Connector v 5.1.42 or earlier
診断
The following appears in the logs
ERROR [spring-startup] com.zaxxer.hikari.pool.HikariPool bitbucket - Exception during pool initialization.
java.sql.SQLException: Unknown system variable 'query_cache_size'
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)
...
原因
The query cache has been removed from the server since MySQL v8.0.3. The connector that supports this has to be version 5.1.43+ (see Connector 5.1.43 release notes)
ソリューション
- Download the latest 5.1.x connector from https://downloads.mysql.com/archives/c-j/
- Copy the mysql-connector-java-5.1.XX-bin.jar file from the extracted directory to your
<Bitbucket home directory>/libdirectory (for Bitbucket Server 2.1 or later). - Stop, and then restart Bitbucket Server. See Start and stop Bitbucket.