Bitbucket Server fails to connect to external database - The MSSQL database user is not configured with correct permission
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
The Bitbucket Server's Sys.Admin attempt to migrate from the internal or a different external database to MSSQL database via the database migration tool in Bitbucket Server UI. The attempt results in a failed migration due to the database user permission. The following trace is seen in the atlassian-bitbucket.log file:
1
2
3
4
Bitbucket does not have adequate permissions to modify the target database when connected as the specified user. Please check that the user has permission to CREATE and DROP tables and to INSERT and DELETE data. For information about creating a database for use with Bitbucket, please refer to the Bitbucket documentation.
com.atlassian.stash.internal.db.DefaultDatabaseManager.validateConfiguration(DefaultDatabaseManager.java:226)
com.atlassian.stash.internal.migration.DefaultDatabaseMigrationService.validateConfiguration(DefaultDatabaseMigrationService.java:85)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Cause
The MSSQL database user does not have proper permission to make the required changes in the database. It expected that the user to have at least the following permissions:
CREATE
INSERT
DELETE
DROP
Resolution
The Database Administrator should grant proper permission to the affected database user to allow the user to make changes to the database reflecting the changes in the Bitbucket Server. The following should be fix the permission issue:
1
GRANT CREATE, INSERT, DROP, DELETE ON <database> TO <database_user>
ℹ️ Replace the <database> to the database assigned to Bitbucket Server and <database_user> to the dedicated database user for Bitbucket Server.
Was this helpful?