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

PostgreSQL .conf文件在哪里?


当前回答

nantha=# SHOW config_file;

config_file

/var/lib/postgresql/data/postgresql.conf (1 行)

nantha=# SHOW hba_file;

hba_file

/var/lib/postgresql/data/pg_hba.conf (1 行)

其他回答

nantha=# SHOW config_file;

config_file

/var/lib/postgresql/data/postgresql.conf (1 行)

nantha=# SHOW hba_file;

hba_file

/var/lib/postgresql/data/pg_hba.conf (1 行)

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

SHOW hba_file;

你应该买

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

我把它定位在这里:

/var/lib/pgsql/9.6/data/postgresql.conf

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

在MacOS Mojave上,我使用brew install postgresql来安装,我在这里找到了它

/ usr / local / var / postgres - postgresql上。

我得到了这个使用下面的sql命令引用在这里的响应:

psql -U postgres -c 'SHOW config_file'