Re: psql on Mac

Ozan Kahramanogullari <[email protected]>
Newsgroups gmane.comp.db.postgresql.novice
Message-ID <CAPiqqLnsgE+CiRAsdtNHiUpODPi1WSKH2QxE5irDbTJwhn_O=w@mail.gmail.com>
Hi Tom, Thank you! I copied and pasted the content of your pg_hba file as
it is. Then, I rebooted my computer.  There is only one installation of
postgreSQL, so there is only such file. It is in the folder
"/Library/PostgreSQL/10/data".


Sorry, but none of this brings me close to the what I see in the tutorial.

Cheers,
Ozan

On Wed, 24 Oct 2018 at 11:08, Tom Lane <[email protected]> wrote:

> Ozan Kahramanogullari <[email protected]> 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
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.