1Backup the pg_hba.conf file by copying it.
2Edit the pg_dba.conf, change `METHOD` to 'trust'
3Restart the PostgreSQL server.
4psql -U postgres.
5ALTER USER postgres WITH PASSWORD 'new_password';
6Restore the pg_dba.conf file.
7Restart the PostgreSQL server.
1# sudo -u postgres psql
2could not change directory to "/root"
3psql (9.1.11)
4Type "help" for help.
5
6postgres=# \password
7Enter new password:
8Enter it again:
9postgres=# \q
10
1sudo sed -ibak 's/^\([^#]*\)md5/\1trust/g' /opt/bitnami/postgresql/conf/pg_hba.conf
2sudo -u postgres pg_ctl reload
3