Postbird can't connect

I’m able to connect to the database in the terminal with psql but postbird keeps saying connection refused. I’m running Pop!_os, using a system76 laptop. I’m not sure if that matters, I’m somewhat new to linux and it’s been difficult in the past to tell if ubuntu help pages apply to me.
For linux, the instructions just say sudo snap install postbird
popos doesn’t come with snap so I downloaded the deb file and installed that from the terminal.
windows install says to login with username postgres, I tried with no database entered and as it is shown below. I tried postgres as password, I’m a bit lost.

1 Like

following as i get the same issue, i am able to run postgre from terminal but not from postbird

So I guess I can either try a different GUI or a different OS? I’m right at the beginning of a course to learn what PostgreSQL is and how to use it, my course asks me to install the programs so I can learn how the programs work. It’s difficult to troubleshoot from this position.

A post was split to a new topic: POSTGRES complaint

Finally found a way!

  1. First of all make sure you got just one postgresql version installed (purge it and reinstall it if you have to, I have installed version 15).

  2. Start the server with:

    ~ sudo pg_ctlcluster 15 main start

  3. Go to terminal window and enter the server with:

    ~ sudo su - postgres
    ~ psql

  4. Create database with encoding:


  5. Enter the database (make sure to use only lower case letters!):

    ~ \c {databaseName}

  6. Create user and password being in that database:

    ~CREATE USER {userName} WITH PASSWORD ‘{yourPassword}’

  7. Now do not close that window ( haven`t tried to run it after closing connection with database but I think that would not work)

  8. Open POSTBIRD and enter all the details of what you have created and VOILA!

Hope that works for you!!


You might have another problem if you don`t have privileges set to superuser or similar.

To change the priviliges:

  1. Open psql:
    ~ sudo su - posgres
    ~ psql
  2. Change your user to be superuser:
  3. You can check if it worked with:
    ~ \du
1 Like

Thanks for the help, maybe some day I’ll get back into programming and try this out. I’m not actively trying to change careers after not being able to figure this out.

I was also unable to connect to a database using postbird (on linux) In addition, I was also receiving the error “could not change directory to …” after running sudo -u postgres psql postgres (whereby I could still use postgres with psql.

The solutions provided by object3516321754 put me on the path to understanding the cause and how to solve it. I’ll try to share these here as best I can.

The problem of being unable to connect via Postbird is because the client expects a user and a password, but the only user that exists initially is “postgres” (which is a super user and does not have a password). You can verify this with \du in psql- whereby you’ll see which users/roles exist.

The error "“could not change directory to …” essentially stems from the same reason. The command sudo -u postgres psql postgres connects you as the superuser “postgres”, which does not have permission to enter your home directory (at least, that is how I understand it).

The solution is to create a new user (role). (The docs advise against creating a new user/role with superuser privileges), so I created a new non-superuser role as follows:

  1. start the server (whereby the number is the postgres version number): ~ sudo pg_ctlcluster 15 main start
  2. login as superuser: ~sudo su - postgres
  3. start psql: ~ psql
  4. create a new role for yourself. Make sure the username is the same as your operating system user account (seen in the terminal thus useraccount@computername): ~ CREATE ROLE username LOGIN CREATEDB PASSWORD 'password'; //make sure to keep the single quotes around password.
  5. You can now close the terminal and reopen it.
  6. Start the server again: ~ sudo pg_ctlcluster 15 main start
  7. Create a new database: ~ createdb mydatabase
  8. login into your new database (if no username is provided, your operating system user is used as default, which is why it is not provided here explicitly) : ~ psql mydatabase //This step is not necessary. It simply illustrates how to enter the database with psql
  9. You will now also be able to log in using Postbird using the username, password and your newly created database.

Something strange I discovered was that if I created a new role with a username that wasn’t identical to my operating system user account, it was impossible for me to log in with it using psql, but I could log in with it using Postbird. I was unable to solve this.