我最近在Ubuntu上安装了PostgreSQL和EnterpriseDB包。我可以连接到本地数据库,但我不能配置它,因为我找不到配置文件。我搜索了整个硬盘驱动器,只找到了像pg_hba.conf.sample这样的样本

PostgreSQL .conf文件在哪里?


当前回答

在Mac上(使用brew安装Postgres):

/usr/local/Cellar/postgresql/9.3.3>bin/postgres -D /usr/local/var/postgres/

其他回答

对于ubuntu 18/20,执行以下命令找到postgresql.conf文件:

locate postgresql.conf

如果你的linux中没有locate,那么先运行sudo apt-get install locate来安装locate。

Run

sudo updatedb

紧随其后的是

locate postgresql.conf

除了直接的答案,你可能还想看看关于Postgres配置文件位置的文档。

在大多数情况下:在$PGDATA下,通常是/var/lib/postgresql/data或类似的路径(如果使用Docker映像,至少它是默认路径)。

在Mac OS X上:

sudo find / -name postgresql.conf 

您可以通过下面的命令找到其他的conf文件:

sudo find / -name pg\*.conf

注:参见用法using man:

man find

我的安装不是默认的,但你可以去Postgres目录,找到子目录\Data。

配置文件 C: \ Postgres \ \ postgresql.conf数据 C: \ Postgres \ \ pg_hba.conf数据