Thread: FATAL: no pg_hba.conf entry for host “::1”

FATAL: no pg_hba.conf entry for host “::1”

From
morny
Date:
Hi,

Im using an application that connects to postgreSQL, now its being tested on
a few machines and connects fine but on 1 machine i get this FATAL: no
pg_hba.conf entry for host “::1”, user “postgres”, database “myDatabase",
SSL off.

Heres the HBACONFIG FILE DETAILS
# TYPE DATABASE USER CIDR-ADDRESS METHOD

# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
#host all all ::1/128 md5

So the issue seems to be with the last line on IPv6, to be honest i dont
even know what IPv6 is, could disabling IPv6 do the trick or do i need to
add something?

The funny thing is with the exact same details a different application
connects to postgreSQL fine? Any ideas and bare in mind im a newbie when
explaining
--
View this message in context:
http://old.nabble.com/FATAL%3A-no-pg_hba.conf-entry-for-host-%E2%80%9C%3A%3A1%E2%80%9D-tp26657579p26657579.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: FATAL: no pg_hba.conf entry for host “::1”

From
"Andy Shellam (Mailing Lists)"
Date:
Hi,


So the issue seems to be with the last line on IPv6, to be honest i dont
even know what IPv6 is, could disabling IPv6 do the trick or do i need to
add something?

Your machine is connecting to PostgreSQL using IPv6's "localhost" address.  IPv6 is a newer format of IP addressing that allows for more IP addresses - ::1 = 127.0.0.1, basically.

Newer TCP/IP stacks attempt to connect to localhost using the IPv6 address first, instead of IPv4 (the current format.)

When you connect, try passing "-h 127.0.0.1" to psql or whatever app/library you're using.  That should force it to connect over IPv4.  Or just uncomment the IPv6 line in your pg_hba.conf and restart PostgreSQL.


The funny thing is with the exact same details a different application
connects to postgreSQL fine? Any ideas and bare in mind im a newbie when
explaining

Is the different application on a different server?  If so, it could be that the other app's OS is using IPv4 by default instead of IPv6.  Or the app is connecting over an IPv4 address (e.g. 127.0.0.1) instead of "localhost."

Regards,
Andy

Re: FATAL: no pg_hba.conf entry for host “::1”

From
Tom Lane
Date:
morny <info@tiltdemon.com> writes:
> # IPv4 local connections:
> host all all 127.0.0.1/32 md5
> # IPv6 local connections:
> #host all all ::1/128 md5

> So the issue seems to be with the last line on IPv6,

Yup: it's commented out.  Get rid of the '#'.

            regards, tom lane

Re: FATAL: no pg_hba.conf entry for host “::1”

From
saleem
Date:
Go to the server where you are trying to connect, open the file "pg_hba.conf"
and add the IP of the machine that you are using to connect to ..

i hope this post helps



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/FATAL-no-pg-hba-conf-entry-for-host-1-tp1873063p5718005.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.