在OS X上找不到pg_hba.conf和postgreql.conf文件?

时间:2015-10-08 12:13:17

标签: macos postgresql homebrew

我使用自制软件安装了postgres。 我想找到他的文件pg_hba.conf和postgresql.conf,但我找不到它们。

我跟着这个:

https://askubuntu.com/questions/256534/how-do-i-find-the-path-to-pg-hba-conf-from-the-shell

和这个

http://www.kelvinwong.ca/tag/pg_hba-conf/

但我仍然找不到它。

7 个答案:

答案 0 :(得分:84)

默认情况下,自制软件会将所有内容放入/usr/local

所以postgresql配置文件将是/usr/local/var/postgres/

答案 1 :(得分:13)

如果您可以作为超级用户(通常是postgres)连接到Pg,只需SHOW hba_file;即可查看其位置。

否则,您必须了解PostgreSQL如何开始定位其数据目录。

答案 2 :(得分:4)

可以在不知道pg admin位置的情况下编辑这些文件 https://dba.stackexchange.com/questions/61193/how-to-edit-postgresql-conf-with-pgadmin

  
      
  • 编辑postgresql.conf文件:选择Tools> Server Configuration> postgresql.conf
  •   
  • 编辑pg_hba.conf文件:选择Tools> Server Configuration> pg_hba.conf
  •   

答案 3 :(得分:3)

最坏的情况是,您可以搜索它:

find / -type f -name pg_hba.conf 2> /dev/null

答案 4 :(得分:1)

了解postgresql.conf位置的另一个解决方案是启动psql并输入 \显示所有 然后搜索' config_file'的值。 对于我的docker配置,这将是/var/lib/postgresql/data/postgresql.conf 然后我可以连接到Docker docker exec -it postgres bash -c" export TERM = xterm-256color;的bash" 并查看其内容 cat /var/lib/postgresql/data/postgresql.conf

答案 5 :(得分:1)

这可能是一个可以找到 postgresql.conf/pg_hba.conf 文件的位置

/opt/homebrew/var/postgres/postgresql.conf  

/opt/homebrew/var/postgres/pg_hba.conf  

答案 6 :(得分:0)

在MacOS Catalina中,该文件夹位于以下位置:

.bbappend