I added a new user to posgresql (amanda
) which is the same as my linux system user. At the console, I can open psql
just fine — I don't need a password because I'm already authenticated as amanda
. But when I try to set up pgAdmin III without a password, I get an error:
An error has occurred:
01:18:47 PM: Error: Error connecting to the server: fe_sendauth: no password supplied
And if I provide my system password, I get a password error:
An error has occurred:
01:15:30 PM: Error: Error connecting to the server: FATAL: password authentication failed for user "amanda"
FATAL: password authentication failed for user "amanda"
How do I get pgAdmin3 talking to postgres as amanda
?
This is all @ localhost. I read this:
PgAdmin III – How to connect to database when password is empty?
but the answer there discusses trust authentication. My read of the auth methods section of the manual suggests that what I want is for pgAdmin3 to use Ident Auth.
Best Answer
On Unix, when psql is used without the
-h
option or aPGHOST
variable set, it uses Unix local domain sockets, which corresponds tolocal
in theTYPE
column inpg_hba.conf
and noADDR
column at all.That differs from putting
localhost
in the host field of pgAdmin's connection dialog. This one corresponds tohost
in theTYPE
column and127.0.0.1
in theADDR
column or whateverlocalhost
is resolved to by the TCP stack (with IPv6 it could be::1
for instance).In general, this is what is confusing when psql and pgAdmin connection attempts do not trigger the same rules in
pg_hba.conf
. If that's the case in this question, try to leave the host field in pgAdmin empty.On top of that, Windows does not have Unix local domain sockets so
psql
on Windows defaults onlocalhost
as if-h localhost
was used.