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

From: Felipe Santos <felipepts(at)gmail(dot)com>
To: Michael Convey <smconvey(at)gmail(dot)com>
Cc: Alan Hodgson <ahodgson(at)simkin(dot)ca>, pgsql-novice(at)postgresql(dot)org
Subject: Re: [pgsql-novice] Daily digest v1.3706 (6 messages)
Date: 2015-11-17 15:57:19
Message-ID: CAPYcRiXerV5cYau_XLGSHzxiaVYTmax6SA+f6oEzyCsQX6xq_g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

2015-11-17 13:49 GMT-02:00 Michael Convey <smconvey(at)gmail(dot)com>:

> On Mon, Nov 16, 2015 at 6:26 PM, Alan Hodgson <ahodgson(at)simkin(dot)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?
>
>
>

Hi Michael,

1) Modify your PG_HBA file with this config:

# "local" is for Unix domain socket connections only
local all all password
# IPv4 local connections:
host all all 127.0.0.1/32 password
# IPv6 local connections:
host all all ::1/128 password

2) Reload your postgres service from the Linux bash forcing it to read the
new config:

service postgres reload

or

/etc/init.d/postgresql reload

3) Try connecting to the database:

psql -U postgres -W postgres

Cheers,

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message petrov.boris.v@mail.ru 2015-11-17 17:54:42 Question about IMMUTABLE function
Previous Message Michael Convey 2015-11-17 15:49:15 Re: [pgsql-novice] Daily digest v1.3706 (6 messages)