Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Migrating to PostgreSQL with superuser account does not have adequate permissions

I am migrating from an existing instance of BitBucket to a new instance on another server. I am fairly new to PostgreSQL (having much experience with MySQL) but have followed the instructions to install Postgres here and here, and then followed the directions to install BitBucket here. Both BitBucket and Postgres seem to be operating OK (BitBucket was able to connect to the bitbucket database on Postgres), but when I try to migrate from my original production BitBucket to the new instance, I get this message:

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

I created two new users in Postgres with what I thought were superuser permissions: bitbucketuser and my local username.

bitbucket=# \du
List of roles
Role name | Attributes | Member of
bitbucketuser | Superuser, Create DB | {}
myusername | Superuser, Create role, Create DB | {}
postgres | Superuser, Create role, Create DB,
Replication, Bypass RLS | {}

I can't login from localhost as the bitbucketuser because it isn't a system user, but I can login as my username.

I then updated the pg_hba.conf file with the correct permissions for Postgres to allow connections (  tail /var/lib/pgsql/11/data/pg_hba.conf):

# allow connection from
host bitbucket bitbucketuser md5
host bitbucket bitbucketuser md5
host bitbucket myusername md5

Where is my original production BitBucket server and is my new server, which hosts both Postgres and the new BitBucket instance. 

I have tried various permutations of the following, as both myself and postgres:

GRANT ALL PRIVILEGES ON DATABASE bitbucket to bitbucketuser;
(depending on "" I occasionally got ERROR: schema "public" does not exist)

In each case, I still get the error message above.

I have deleted the Public schema under the bitbucket database and recreated it, but I get the same results.


Any help would be greatly appreciated. Thanks for your attention.

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

2,124 views 0 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you