Postgresql – Error with pgAdmin III and pg_hba.conf

authenticationpgadminpgadmin-3postgresqlUbuntu

I have a problem with my Pgadmin3.. I used to use the last year, but this year I can't connect with the localhost server with pgadmin

This is the message error:

FATAL: no pg_hba.conf entry for host "127.0.0.1", user "postgres", database "postgres", SSL on
FATAL: no pg_hba.conf entry for host "127.0.0.1", user "postgres", database "postgres", SSL off

My pg_hba.conf file have this content:

TYPE       DATABASE USER                ADDRESS                 METHOD
local      all                          all                     trust

I can connect without problems with psql. My user is postgres and my pass is postgres too.

I have information in the database, i don't have idea what's happen.

My OS is Linux Lubuntu 14.04

Best Answer

Look at the first column TYPE, from the docs

local This record matches connection attempts using Unix-domain sockets. Without a record of this type, Unix-domain socket connections are disallowed.

host This record matches connection attempts made using TCP/IP. host records match either SSL or non-SSL connection attempts.

Your type is local, but your error message indicates you're trying to connect to 127.0.0.1 which is an IP address. You either need to connect using unix sockets without an ip-address (no -h in psql) or change the type to host.

From the docs on PgAdminIII

The host is the IP address of the machine to contact, or the fully qualified domain name. On Unix based systems, the address field may be left blank to use the default PostgreSQL Unix Domain Socket on the local machine, or be set to an alternate path containing a PostgreSQL socket. If a path is entered, it must begin with a “/”. The port number may also be specified.