Re: [pgsql-novice] Daily digest v1.3706 (6 messages) - Mailing list pgsql-novice

From Michael Convey
Subject Re: [pgsql-novice] Daily digest v1.3706 (6 messages)
Date
Msg-id CACbnAKZn_1z9+0WX5xpmnQ5QtL0zD536vaTtq7t6pc69ngnHHA@mail.gmail.com
Whole thread Raw
In response to Re: [pgsql-novice] Daily digest v1.3706 (6 messages)  (Alan Hodgson <ahodgson@simkin.ca>)
Responses Re: [pgsql-novice] Daily digest v1.3706 (6 messages)  (Felipe Santos <felipepts@gmail.com>)
List pgsql-novice
On Mon, Nov 16, 2015 at 6:26 PM, Alan Hodgson <ahodgson@simkin.ca> wrote:
On Monday, November 16, 2015 05:36:08 PM Michael Convey wrote:
> ​Thank you. Assuming a default Fedora installation, if I am logged in as
> Linux user lab and I don't know the Linux "postgres"​ password, but I do
> know the PostgreSQL "postgres" role password; what is the syntax (from the
> Linux command line) to login as the "postgres" role and connect to the
> "postgres" database?

psql -U postgres postgres

It'll prompt for the password.

Make sure you've enabled md5 or password as an authentication method allowed
for local in pg_hba.conf.

​Thank you. I received the following error:

bash-4.2 ~ $ psql -U postgres postgres
psql: FATAL:  Peer authentication failed for user "postgres"

Here's the relevant portion of my ​pg_hba.conf file:

-----------------------------------------------------------------------------------------------------------
# TYPE  DATABASE        USER            ADDRESS                 METHOD

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

Do I modify the first section, as follows?

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
local   all             all             samehost          md5    #added

Or, do I replace the first line with #added?


pgsql-novice by date:

Previous
From: "petrov.boris.v@mail.ru"
Date:
Subject: Re: Different performance of two simple queries
Next
From: Felipe Santos
Date:
Subject: Re: [pgsql-novice] Daily digest v1.3706 (6 messages)