I'm trying to make it so that local connections to the database don't require a login. So I added the line local all all trust
to the pg_hba.conf file, but then when I load pgAdmin and try to connect to the server it just says FATAL: could not load pg_hba.conf
. What am I doing wrong?
-
Post the lines from your pg_hba.conf that are not commented out (obfuscate any personally identifiable networks/hosts if you like).– bmaAug 21, 2013 at 0:43
-
3Also, look in the db log, there could be a line just before that FATAL message giving an indication what the problem is, eg. a bad entry in the file.– bmaAug 21, 2013 at 0:49
-
Is pgAdmin running on the same machine as the server? Is the Postgres server running and only pgAdmin complaining?– Erwin BrandstetterAug 21, 2013 at 9:57
2 Answers
There is likely an invalid entry in pg_hba.conf file. Reload it and then check the PostgreSQL server log for any pg_hba.conf error:
pg_ctl reload -D $PGDATA
-
1$ pg_ctl reload -D $PGDATA pg_ctl: option requires an argument -- 'D' Try "pg_ctl --help" for more information. Sep 8, 2016 at 18:18
The problem is that this postgres version under win7 can not handle local connections. I had to work with pg very urgently on my local computer so I did not care too much about security so maybe this is not the best solution for a live environment. But my local PC it was enough.
I removed all other uncommented lines from pg_hba.conf and left in only the following one:
host all all ::1/0 trust
After this I could connect via command line.
I do not understand why the manual tells no more about this issue. I am pretty sure many people have problem with this.
-
2"postgres version under win7 can not handle local connections" - that's plain wrong.– user1822Feb 11, 2014 at 22:44
-
Encountered the same issue with postgres 9.5 in Window2021 R2. Postgres log reported: "CDT LOG: local connections are not supported by this build" Sep 28, 2021 at 20:41