2

I am unable to connect using psql to PostgreSQL 9.6 on Windows 10. I saw almost all the StackExchange questions regarding this error. While installing Postgres it asked for superuser password and I set it. Added host all all 0.0.0.0/0 trust and host all all ::0/0 trust to pg_hba.conf but still no luck. This is the pg_hba.conf contents on my machine:

host    all             all             localhost               trust

host    all             all             127.0.0.1/32            trust

IPv6 local connections:

host    all             all             ::1/128                 trust

host    all             all             ::0/0                   trust

host    all             all             0.0.0.0/0               trust

Any help would be appreciated.

5
  • Could you please show how exactly you are attempting to connect (I mean the command line)? The server and the client are on the same machine, IIUC. Commented Feb 1, 2018 at 9:14
  • psql -h 127.0.0.1 -U postgres -d postgres i tried to give this Commented Feb 1, 2018 at 9:28
  • 1
    Please look at the server log and search for the line where it confirms that the file is correctly reloaded. Commented Feb 1, 2018 at 9:37
  • I have very little experience with databases on Windows, but I remember that the loopback adapter had to be "installed" or activated, it didn't exist by default. If you check your hosts file, do you find "127.0.0.1 localhost"? Another possibilty is your server is listening on IPv6 only. Commented Feb 1, 2018 at 19:02
  • 1
    Quoting "postgresql.org/docs/devel/static/auth-pg-hba-conf.html" : The pg_hba.conf file is read on start-up and when the main server process receives a SIGHUP signal. If you edit the file on an active system, you will need to signal the postmaster (using pg_ctl reload or kill -HUP) to make it re-read the file. Did you restart? Commented Feb 2, 2018 at 10:15

2 Answers 2

0

Here is what I did , I have no idea why it worked but it may help you lol.

The error message is something like :

FATAL: no pg_hba.conf entry for host “fe70::3069:d1cc:6120:27e5%15” ...bla..bla

I don't even know much about IP6 but I assume that long weird number is my ip6, so I added it to my pg_hba.conf

  host    all             all             fe70::3069:d1cc:6120:27e5/96  trust

That /96 is what I took from the manual. I can care less about what it mean since it is dev env. and ABOVE ALL it works on my

0

Per your configuration, you are exposing all the IPs to your database which is not recommended.

Please reload the config file using /usr/edb/bin/pg_ctl -D /datadirectorypath reload

Post reload, you may try to connect again.

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