Re: psql on Mac

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: psql on Mac
Дата
Msg-id 19047.1540372132@sss.pgh.pa.us
обсуждение исходный текст
Ответ на psql on Mac  (Ozan Kahramanogullari <ozan.kah@gmail.com>)
Ответы Re: psql on Mac  (Ozan Kahramanogullari <ozan.kah@gmail.com>)
Список pgsql-novice
Ozan Kahramanogullari <ozan.kah@gmail.com> writes:
> Thank you, Andrej. I tried the instructions in this website. However, this
> did not provide the desired outcome. I am pasting the command line
> below.Also, the command "psql -h localhost" did not work.

> XXX:src3 ozan$ psql -h localhost
> Password:
> psql: FATAL:  password authentication failed for user "ozan"

This definitely indicates that the server thinks you specified password
auth (of one flavor or another).  Now this:

> local   all             all                                     trust

looks like it ought to let everything in without a password, but the
problem is that "local" only means Unix-socket connections.  So it
should apply when you say "psql" or "psql -U somebody", but it does
*not* apply to TCP connections which is what you get with "-h localhost".
What you really want, if you just want to let in all same-machine
connections indiscriminately, is this:

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

(copied from what I've got on my Mac).

> local   postgres        postgres                                trust
> local   all             postgres                                trust

These lines are pretty pointless given the previous "local all all"
line; that one will capture any connections that these could match.

> XXX:src3 ozan$ psql -U ozan
> Password for user ozan:
> psql: FATAL:  password authentication failed for user "ozan"

This, on the other hand, suggests that you've got still more problems;
this should have matched the "local all all" line, but obviously it
did not.  Somewhere the server is finding a pg_hba.conf line that is
telling it to use password authentication.  Some possibilities:

1. You aren't editing the right pg_hba.conf file.  ("show hba_file"
should confirm where the server thinks that file is.  In PG v10 or
newer, the pg_hba_file_rules view is also helpful.)

2. You stuck the lines you're showing us at the bottom of an existing
pg_hba.conf file, not paying attention to earlier lines that would
control what the server does.  The rule is that the first entry in
pg_hba.conf that matches the connection request is what's used.  So
be sure to delete or comment out rules you don't want.

3. You edited the right file, but didn't restart or reload the server
afterwards, so it's still using old data.

            regards, tom lane


В списке pgsql-novice по дате отправления:

Предыдущее
От: Ozan Kahramanogullari
Дата:
Сообщение: Re: psql on Mac
Следующее
От: Ozan Kahramanogullari
Дата:
Сообщение: Re: psql on Mac