我最近在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 行)

其他回答

在Mac OS X上:

sudo find / -name postgresql.conf 

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

sudo find / -name pg\*.conf

注:参见用法using man:

man find

Run

sudo updatedb

紧随其后的是

locate postgresql.conf

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

locate postgresql.conf

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

The 30-07-2019

在Windows 10 pro中:

C:\Program Files\PostgreSQL\11\data

或者问问你的数据库:

$ psql -U postgres -c 'SHOW config_file'

或者,如果以ubuntu用户登录:

$ sudo -u postgres psql -c 'SHOW config_file'