Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgresql: How to find pg_hba.conf file using Mac OS X

Tags:

postgresql

Hi I am having trouble with postgres. I don't remember my postgres password and don't know how to change the password. I'm guessing I should change the md5 password settings I set a month ago, but I don't know how to find the file and open it using my terminal. Can someone help?

like image 416
bigpotato Avatar asked Dec 24 '12 21:12

bigpotato


People also ask

Where is my Pg_hba conf file?

By default, the file is named pg_hba. conf. By default, on RHEL 7 , the file is at /var/lib/pgsql/data/, and on Windows, the file is at C:\Program Files\PostgreSQL\ version_number \data\.

Where is Postgres installed on Mac?

The actual database files will be under /usr/local/var/postgres after you create the database.

What is PostgreSQL conf file in PostgreSQL?

conf is PostgreSQL's main configuration file and the primary source of configuration parameter settings. postgresql. conf is a plain text file generated by initdb and is normally stored in the data directory. However some distributions' packages may place postgresql.

What is Pg_hba Conf entry?

conf File. Client authentication is controlled by a configuration file, which traditionally is named pg_hba. conf and is stored in the database cluster's data directory. ( HBA stands for host-based authentication.)


1 Answers

Another way I learned recently is to go to the terminal and type:

ps aux | grep postgres

which shows all the postgres processes running on your machine. From the list you should see one with the format ... -D .... E.G:

root            4155   0.0  0.0  2432908     68   ??  S     6May13   0:00.01 sudo su postgres -c /opt/local/lib/postgresql84/bin/postgres -D /opt/local/var/db/postgresql84/defaultdb -p 5432 

the -D means directory. In the terminal, do a sudo su and then cd to that directory, and you'll find the pg_hba.conf file.

And one more way:

Go to your terminal and type: locate pg_hba.conf. There should be a few results.

like image 181
bigpotato Avatar answered Sep 20 '22 11:09

bigpotato