I installed postgres using homebrew. I would like to locate he files pg_hba.conf and postgresql.conf but I cannot find them.
I followed this :
https://askubuntu.com/questions/256534/how-do-i-find-the-path-to-pg-hba-conf-from-the-shell
and this
http://www.kelvinwong.ca/tag/pg_hba-conf/
but I still cannot find it.
pg_hba. NOTE: In MacOS, depending on how Postgres was installed, the file will typically be located at /usr/local/var/postgres . Execute the following shell command to open the file using the Sublime IDE: sudo subl /usr/local/var/postgres/pg_hba. conf .
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\.
Source code. Functions related to modifying postgresql. auto. conf are located in src/backend/utils/misc/guc.
By default homebrew, on intel Macs, puts everything in /usr/local
So the postgresql conf files will be /usr/local/var/postgres/
If you are on an M1 Mac, brew will use a path like /opt/homebrew/var/postgres/pg_hba.conf
If you can connect to Pg as the superuser (usually postgres
) simply SHOW hba_file;
to see its location.
Otherwise you have to find out how PostgreSQL is started to locate its data directory.
Worst case, you can search for it:
find / -type f -name pg_hba.conf 2> /dev/null
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With