How to reset the Postgres server password on the Mac systems

#How to reset Postgres server password in Mac systems
###################################################################

#Step1: sudo -u postgres chmod 777 /Library/PostgreSQL/9.6/data

#Step2:

cd /Library/PostgreSQL/9.6/data
sudo -u postgres cp pg_hba.conf pg_hba_bk.conf

sudo -u postgres vi pg_hba.conf

#### enable trust for all the local connections

#### eg: local  all   all   trust

#Step3:

sudo -u postgres chmod 700 /Library/PostgreSQL/9.6/data

#Step4:

#### restarting postgres service
sudo -u postgres ./pg_ctl restart -D /Library/PostgreSQL/9.6/data/

####Test psql connection, it will not ask password

Comments