Search Postgresql Archives

Re: I lost my password

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27/07/2015 04:15, papa@xxxxxxxxxxx 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@xxxxxx


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux