All we need is an easy explanation of the problem, so here it is.
I am hosting two different databases (
manage_invite_v49) on the same server.
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
How to solve :
I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.
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
Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂