![]() ![]() Yes, this is somewhat of a chicken-and-egg problem, in that if the user can't connect (say, after screwing up editing pg_hba.conf) you can't find pg_hba.conf in order to fix it.Īnother option is to look at the ps command's output and see if the postmaster data directory argument -D is visible there, e.g. This command must be run on a superuser session, so for shell scripting you might write something like: psql -t -P format=unaligned -c 'show hba_file' Īnd set the environment variables PGUSER, PGDATABASE, etc to ensure that the connection is right. What you want to do is ask PostgreSQL: SHOW hba_file You can't even rely on asking where the datadir is and parsing nf because an init script might passed a param like -c hba_file=/some/other/path when starting Pg. ![]() The only valid ways find pg_hba.conf is to ask a running PostgreSQL instance where it's pg_hba.conf is, or ask the sysadmin where it is. The standard location is pg_hba.conf within the data_directory of the database (which could be in /home, /var/lib/pgsql, /var/lib/postgresql//, /opt/postgres/, etc etc etc) but users and packagers can put it wherever they like. Pg_hba.conf can appear in many other places depending on how Pg was installed. It knows nothing about the active PostgreSQL instance(s) on the machine, only the binaries. ![]() Pg_config is for compliation information, to help extensions and client programs compile and link against PostgreSQL. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |