Question

Newbie to postgresql on Centos 7 and unable to edit the pg_hba.conf due to it asking for postgres password which is unknown

Posted August 25, 2016 2.5k views
CentOS PostgreSQL

Having problems with postgresql installation on CentOS 7. I uninstalled postgresql, deleted the postgres data directory and reinstalled but now when going through the setup steps to change the pg_hba.conf from indent to md5 it is asking for a postgres password and I did not set it, so I don’t know what it is.

1 comment
  • What method did you use to remove PostgreSQL from your droplet? I attempted to duplicate your issue by doing the following on a freshly created CentOS 7 droplet.

    yum install postgresql-server 
    

    verifying the data directory at /var/lib/pgsql and then doing a

    yum remove postgresql-server
    

    After doing this the data directory was already removed. Having to delete it manually would indicate to me that you may have used a method like rpm -e to remove postgresql-server instead which could preserve your settings. If this is the case, try using yum to remove it again and re-install. This should leave you with a clean installation of PostgreSQL without any of your old configuration (or password) settings remaining.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

This question was answered by @ryanpq:

What method did you use to remove PostgreSQL from your droplet? I attempted to duplicate your issue by doing the following on a freshly created CentOS 7 droplet.

yum install postgresql-server 

verifying the data directory at /var/lib/pgsql and then doing a

yum remove postgresql-server

After doing this the data directory was already removed. Having to delete it manually would indicate to me that you may have used a method like rpm -e to remove postgresql-server instead which could preserve your settings. If this is the case, try using yum to remove it again and re-install. This should leave you with a clean installation of PostgreSQL without any of your old configuration (or password) settings remaining.

View the original comment

Submit an Answer