Re: Retrieve postgres password

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: "ray madigans(dot)org" <ray(at)madigans(dot)org>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Retrieve postgres password
Date: 2015-09-02 23:52:03
Message-ID: 55E78BA3.9040907@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gerdan Rezende dos Santos 2015-09-03 01:28:07 error on online backup using pg_basebackup tool
Previous Message Craig Ringer 2015-09-02 23:49:36 Re: FDW and BDR