Re: Retrieve postgres password - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Retrieve postgres password
Date
Msg-id 55E78BA3.9040907@aklaver.com
Whole thread Raw
In response to Retrieve postgres password  ("ray madigans.org" <ray@madigans.org>)
List pgsql-general
On 09/02/2015 04:43 PM, ray madigans.org wrote:
> I have lost/forgotten the postgres password for my installation so I did
> the following.
>
> I edited pg_hba.conf and added an entry:
>
> local all all trust
>
> restarted postgresql.
>
> loged in as postgres (psql template1 -U postgres)
>
> change the postgres password with
>
> ALTER ROLE postgres PASSWORD foo
>
> I edited pg_hba.conf and get rid of the added line
>
> restarted postgres
>
> when I attempted to reenter with
>
> psql template1 -U postgres --password
>
> I get an error Peer authentication failed for user "postgres"
>
>
> Not sure what I did wrong, any help would be appreciated.

Well in pg_hba.conf first match wins, so I would say you have a line the
uses peer authentication before one that uses md5(password).

Can you show us the contents of the pg_hba.conf file?

>


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: FDW and BDR
Next
From: Gerdan Rezende dos Santos
Date:
Subject: error on online backup using pg_basebackup tool