Saturday, December 24, 2011

[PostgreSQL][Mac] Modify root password (Forgot password)

  • sudo su postgres
  • supply your Mac password
  • modify /Library/PostgreSQL/9.x/data/pg_hba.conf
    • from local all all   md5
    • to local all all   trust
  • execute /Library/PostgreSQL/9.x/bin/pg_ctl restart -D /Library/PostgreSQL/9.x/data/
  • run psql
  • change postgres password
    • ALTER USER postgres WITH ENCRYPTED PASSWORD 'password';
  • modify pg_hba.conf back
  • restart again
Tested with PostgreSQL version 9.1 OSX Lion


Steve said...

This totally worked for me! Thanks!

Ray said...

I'm a bit stuck here. Can you help? Thanks

execute /Library/PostgreSQL/9.x/bin/pg_ctl restart -D /Library/PostgreSQL/9.x/data/

I just went into the file and double clicked on the pg_ctl and it executed..
afterwards how do you restart it? I've tried restarting the and tried running sql but it still requires me to enter in a password....

James Kitcher said...

Bump. Running PostgreSQL 9.3 on Mac OSX 10.9.5

Modified the .conf file as directed, restarted the server and reloaded the configuration but can't get to psql from the command line and running psql from Applications/PostgreSQL 9.3 GUI launcher requires the postgre user pw -- that I'm trying to change because I'm an idiot and misplaced it and forgot it after a fresh install.

Shannon Morrell said...

Thank you so much! There is so much bad info on the web but thankfully I found this. It worked perfectly. =)

Config number of file descriptors on Linux

Check file descriptor limit for a process. Vary depending on owner of the process $ cat /proc/{process-id}/limits Check current number of...