0

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: ****

pkaramol
  • 16,451
  • 43
  • 149
  • 324
  • Change `md5` to `trust` – Vivek S. Nov 27 '15 at 11:59
  • Password authentication failed means you passed in the wrong password. You could follow @wingedpanther's suggestion and change to `trust`, which allows you to log in without a password. – Andomar Nov 27 '15 at 12:00
  • I have made several attempts and all of them succeed when attempting command line and failing in pgdamin3 (so the chance of wrong pass is extremely small). – pkaramol Nov 27 '15 at 12:16
  • changing to `trust` did not work either... when passing the same psswd I got the same error and using no passwd I got a `no passwd supplied` error – pkaramol Nov 27 '15 at 12:39
  • The lines in your `pg_hba.conf` only allow connections from localhost, try something like `0.0.0.0/0` for ipv4, and `::0/0` for ipv6 – Andomar Nov 27 '15 at 13:31

1 Answers1

0

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....

pkaramol
  • 16,451
  • 43
  • 149
  • 324