I am trying to connect to the PostgreSQL-11 using psql-11 and pgpass as I want to avoid password request.
I used following post: Run a PostgreSQL .sql file using command line arguments. I checked other resources but wasn't able to identify issue.
Content of ~/.pgpass (chmod 0600)
*:*:*:postgres:postgres
Content of pg_hba.conf
# 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 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
I am using following command to connect to the Database:
psql -U postgres -h 10.20.110.43 -p 5432 -d PostgreDB -w
It is working when I am excluding -w, but in this case I have to type in a password. I also can see that pgpass will be checked, as when I am using wrong permissions system ask me to change it to 0600.
Thanks for your help!