Forgotten password for Postgresql - Resetting password - Mac OS X Leopard

I used blog entry by Robby on Rails site:

http://www.robbyonrails.com/articles/2008/01/22/installing-ruby-on-rails-and-postgresql-on-os-x-third-edition

Got to the end, but when I tried accessing the pg database I was denied.

I've tried to change pg_hba.config file to trust so that I can gain access anyway (without a password), but proved fruitless.

Please help. Thanks in advance.

Upvotes: 3

Views: 7920

Answers (1)

someName
someName

Reputation: 1273

Restart postgresql after you alter the pg_hba.config file to make sure your changes are read. Next, type

psql -U myUser template1

in a terminal, where myUseris the name of the user running the postgres proces. That should make you log in as administrator. Next, in the psql session, write

ALTER USER realUser PASSWORD 'myNewPassword';

in order to reset the password. Here realUseris the user of the database you are trying to connect to.

Upvotes: 3

Related Questions