Re: I lost my password - Mailing list pgsql-general

From
Subject Re: I lost my password
Date
Msg-id 6B286EA2B04A43B595886EA978569393@ArbolOnePC
Whole thread Raw
In response to Re: I lost my password  (Raymond O'Donnell <rod@iol.ie>)
Responses Re: I lost my password
List pgsql-general
It worked!
Thanks kids, that was awesome!

One last question, is there a tutorial about accessing the back end using
c++
Again, thanks soooo much!

-----Original Message-----
From: Raymond O'Donnell
Sent: Monday, July 27, 2015 9:28 AM
To: papa@arbolone.ca ; Adrian Klaver ; PostGreSQL MailingList
Subject: Re: [GENERAL] I lost my password

On 27/07/2015 04:15, papa@arbolone.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@iol.ie



pgsql-general by date:

Previous
From: Melvin Davidson
Date:
Subject: Re: Connections closing due to "terminating connection due to administrator command"
Next
From: "Greg Sabino Mullane"
Date:
Subject: Re: This utility can only upgrade to PostgreSQL version 9.4