Re: I lost my password

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: papa(at)arbolone(dot)ca, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, PostGreSQL MailingList <pgsql-general(at)postgresql(dot)org>
Subject: Re: I lost my password
Date: 2015-07-27 13:28:05
Message-ID: 55B631E5.40101@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 27/07/2015 04:15, papa(at)arbolone(dot)ca wrote:
> OK, I think I should tell you folks that I am a newbie. I am using
> postgresql to learn the SQL for the purpose of learning storing the data
> in my c++ application. I have near zero knowledge of SQL or PostgreSQL
> for that matter.
> When I type C:\pgsql, I am asked to entered a password, but I don't
> recall the any passwords I might've set up at installation time.

Hello there,

Adrian's advice about re-installing is probably the easiest way to do
it. However, here's another route, just for completeness (I'm assuming
that you're installing on your own laptop or similar, not a server):

Find the file pg_hba.conf in the data directory. Look for a "host" line
like this:

host all all 127.0.0.1/32 md5

Change "md5" to "trust", save the file and re-start the PostgreSQL
service. You should then be able to connect without a password:

psql -U postgres

NB - If you don't specify a Postgres user with -U, Postgres assumes that
you're connecting as the current operating system user.

You can then reset the password for the user "postgres" (or whatever
user you used to connect):

alter role postgres with password 'whatever';

Don't forget to edit pg_hba.conf once again and set "trust" back to
"md5' (and re-start the service).

Finally, note that the "postgres" user is the super-user, so the usual
caveats apply... better to create another ordinary user for normal
connections.

I hope this helps,

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2015-07-27 13:28:15 Re: I lost my password
Previous Message papa 2015-07-27 13:22:17 Re: I lost my password