Heath Borders
Heath Borders

Reputation: 32107

How do I reset the postgresql 9.2 default user (usually 'postgres') password on mac os x 10.8.2?

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?

Upvotes: 39

Views: 67804

Answers (1)

Heath Borders
Heath Borders

Reputation: 32107

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/

Upvotes: 97

Related Questions