Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed postgres on my mac running 10.6.8 and I would like to reset the password for the postgres user (I believe this is the super user password) and then restart it.

All the directions I found do not work because I think my user name is not recognized by pg as having authority to change the password. (I am on the admin account of my mac)

Here is what I tried:

Larson-2:~ larson$ psql -U postgres
Password for user postgres: 
psql (9.0.4, server 9.1.2)
WARNING: psql version 9.0, server version 9.1.
         Some psql features might not work.
Type "help" for help.

postgres=# ALTER USER postgres with password 'mypassword'
postgres-# \q

and for restart I did:

Larson-2:~ larson$ su postgres -c 'pg_ctl -D /opt/local/var/db/postgresql84/defaultdb/ restart

Which didn't work, as the password remained the same as it was before. Can someone provide directions for doing this and for making sure it's recognized by PG?


I went ahead and edited the pg_hba.conf file located in /Library/PostgreSQL/9.1/data and set the settings as follows:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all               trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

However, like before, the password stayed the same after I changed it. I am not sure what further steps I can take from here.

share|improve this question
Your pg_hba.conf doesn't look like the one I referenced; does it have a line like "local all postgres ident same user"? – skub Jan 26 '12 at 2:27
It actually never had that line (this is my first time touching this file since I set up pg), the only changes I made was substituting trust for md5. I am guessing that the blog post refers to an older version of pg (from 2008) that had differently formatted config files. – Andrew Lauer Barinov Jan 26 '12 at 2:47
Do you have a local user called postgres? – skub Jan 26 '12 at 21:01



now, in pg_hba.conf

local   all             all                                     md5
host    all             all               md5
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.