Nishadh KA

Recover password for postgresql

2014-01-25


based on http://scratching.psybermonkey.net/2009/06/postgresql-how-to-reset-user-name.html

  1. Edit the file sudo nano /etc/postgresql/9.1/main/pg_hba.conf
  2. change into local all postgres md5 local all postgres trust|
  3. then do a restart sudo service postgresql restart
  4. now enter into the PostgreSQL using

    psql -U postgres
    ALTER USER postgres with password 'new password';
    
  5. then again change the pg_hba.conf as earlier and restart the PostgreSQL for invoking the password protection