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

PostgreSQL .conf文件在哪里?


当前回答

对于Debian 9,我使用Franke Heikens的答案- $ /etc/postgresql/9.6/main/postgresql.conf

其他回答

要获得pg_hba.conf文件的位置,还可以像这样查询数据库

SHOW hba_file;

你应该买

            hba_file             
---------------------------------
 /var/lib/pgsql/data/pg_hba.conf
(1 row)

Ubuntu 13.04使用软件中心安装:

我的位置是:

/etc/postgresql/9.1/main/postgresql.conf

因为我没有访问postgres帐户(所以不能运行SHOW config_file),我的postgres安装在Windows上,没有一个答案对我有帮助,所以我把我的文件位置分享给未来的Windows读者:

C:\Program Files\PostgreSQL\9.5\data

在linux上的默认位置是:

cd /etc/postgresql/12/main/

12-version 根据安装版本不同,版本可能不同

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

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