Search code examples
postgresqlpostgresql-9.3pgadminphppgadmin

postgresql: Failing to connect locally via pgadmin3 (and phppgadmin)


I am able to connect via command line but getting the usual error message in pgadmin3.

Error connecting to the server: FATAL: password authentication failed for user "postgres"

(and login failed in phppgadmin)

I know there are several q/a about this but none is addressing command-line success / pgadmin3 failure.

I have made the suggested changes such as:

adding listen_addresses = '*' in postgresql.conf

as also modifying trailing lines of pg_hba.conf as follows (to switch from peer to md5):

# "local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#host    replication     postgres        127.0.0.1/32            md5
# host    replication    postgres        ::1/128                 md5

what is more, connection in the following way fails:

psql -h localhost -U postgres -d postgres

(password failure) however, connection like this succeeds: sudo -u postgres psql Password: ****


Solution

  • It turns out that the server was listening to 5433 and both GUIs were trying to connect to 5432... the error message

    password authentication failed

    was very misleading though....