0

I am hosting two different databases (manage_invite and manage_invite_v49) on the same server.

enter image description here

As you can see, when I try to connect them using the CLI, it demands the password for the second database only. But they are on the same server therefore the pg_hba.conf file is the same for both database. Do you know what could the issue be? I would like my manage_invite_v49 db to be accessible without a password, as the first one.

Here is my pg_hba.conf file:

# Database administrative login by Unix domain socket
local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            md5
host    replication     all             ::1/128                 md5

1 Answer 1

4

You are trying to connect according to the rule below

host    all             all             127.0.0.1/32            md5

which says password is required. Most probably there is a line in .pgpass which has password for manage_invite database only. You can either remove -h localhost from command line which will use the line below;

local   all             all                                     trust

and therefore psql just wont asks for password or add a password line for manage_invite_v49 database.

1
  • You are right! There is a line for manage_invite in the .pgpass file. I replaced manage_invite with an asterix (*) and it worked!
    – Androz2091
    Jun 11, 2021 at 6:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.