Bitbucket Server 2.7 fails to start with MySQL when binary logging is enabled

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 the user tries to connect an external MySQL database, this error will appear in the atlassian-bitbucket.log:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 The schema could not be created. com.atlassian.bitbucket.internal.db.DefaultDatabaseManager.createSchema(DefaultDatabaseManager.java:313) com.atlassian.bitbucket.internal.db.DefaultDatabaseManager.prepareDatabase(DefaultDatabaseManager.java:154) com.atlassian.bitbucket.internal.maintenance.SpringMaintenanceTaskFactory.setupTask(SpringMaintenanceTaskFactory.java:139) ... liquibase.exception.DatabaseException: Error executing SQL UPDATE `bitbucket`.`DATABASECHANGELOGLOCK` SET `LOCKED` = 1, `LOCKEDBY` = 'secondary-1.versioning.infra-all-versioning-001.eqx (10.22.49.12)', `LOCKGRANTED` = '2013-09-09 10:04:53.844' WHERE `ID` = 1 AND `LOCKED` = 0: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. liquibase.lockservice.LockService.acquireLock(LockService.java:121) liquibase.lockservice.LockService.waitForLock(LockService.java:61) liquibase.Liquibase.update(Liquibase.java:102) ... Error executing SQL UPDATE `bitbucket`.`DATABASECHANGELOGLOCK` SET `LOCKED` = 1, `LOCKEDBY` = 'secondary-1.versioning.infra-all-versioning-001.eqx (10.22.49.12)', `LOCKGRANTED` = '2013-09-09 10:04:53.844' WHERE `ID` = 1 AND `LOCKED` = 0: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62) liquibase.executor.jvm.JdbcExecutor.update(JdbcExecutor.java:229) liquibase.executor.jvm.JdbcExecutor.update(JdbcExecutor.java:206) ... Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078) com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4190) com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4122)

Cause

Bitbucket Server 2.7 uses READ_COMMITTED instead of relying on the MySQL default isolation level (REPEATABLE_READ) as Bitbucket Server 2.6 and earlier. MySQL does not support binary logging in the STATEMENT mode.

Resolution

You will need to set the binary logging information in MySQL configuration by following the steps below.

  • As per what is stated on our official documentation:

    If MySQL is using binary logging, configure the database to use a binary logging format of either MIXED or ROW.

  • Open MySQL configuration file in your favourite file editor.

  • Below you see the two possibilities for configuring your MySQL server. Add either one of the following lines:

Configuring db server as MIXED

1 2 [mysqld] binlog_format = 'MIXED'

OR

Configuring db server as ROW

1 2 [mysqld] binlog_format = 'ROW'

  • Restart MySQL server.

  • Restart Bitbucket Server

Updated on April 15, 2025

Still need help?

The Atlassian Community is here for you.