less than 1 minute read

Reset process

Warning: This process supposed to delete all postgres data and configuration

Run The following:

Note: replace X.x with version number

sudo su
service postgres-X.x stop # stops postgres services  
rm –rf /var/lib/pgsql/X.x/data/*
sudo service postgresql-X.x initdb
service postgres-X.x start

Additional info

The database connection will be lost until data/pg_hba.conf is configured. To allow all connection we add host all all trust on /var/lib/pgsql/X.x/data/pg_hba.conf. This translates to allow type host to allow connection to all database, using any user, from ip range of –, without any credentials.

To only reset system password

To just reset the password instead of deleting all the configuration & data-

Run The following:

sudo -u postgres psql
Enter new password twice 

Leave a comment