41

I just installed PostgreSQL 9.2 from enterprisedb onto Mac OS X 10.8.2. I mistyped my postgres user password, so I can't connect. How do I reset the password?

1 Answer 1

98

Found directions:

sudo su postgres

modify /Library/PostgreSQL/9.2/data/pg_hba.conf

-local all all   md5
+local all all   trust

restart postgres

/Library/PostgreSQL/9.2/bin/pg_ctl restart -D /Library/PostgreSQL/9.2/data/

Connect to postgres:

psql

Inside psql (\q to quit):

ALTER USER postgres WITH ENCRYPTED PASSWORD 'password';

modify pg_hba.conf back

+local all all   md5
-local all all   trust

restart postgres

/Library/PostgreSQL/9.2/bin/pg_ctl restart -D /Library/PostgreSQL/9.2/data/
Sign up to request clarification or add additional context in comments.

3 Comments

There is no need to restart Postgres after changing pg_hba.conf. You just need to reload it using pg_ctl reload.
I had to set PG_DATA=pwd/data when I was in the right postgres root dir to be able to run pg_ctl restart.
in case su is not set up before on your mac then follow instructions from below to set it up. support.apple.com/en-us/HT204012

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.