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

PostgreSQL .conf文件在哪里?


当前回答

在ubuntu中,你可以找到

/etc/postgresql/11/main/pg_hba.conf

// after change restart it otherwise it won't be work

service postgresql restart

其他回答

在Mac OS X上:

sudo find / -name postgresql.conf 

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

sudo find / -name pg\*.conf

注:参见用法using man:

man find

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

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

Fedora 20

$ cd /var/lib/pgsql/data
$ ls -ltr *.conf

-rw-------. 1 postgres postgres 20453 Jan 18 23:22 postgresql.conf
-rw-------. 1 postgres postgres  1636 Jan 18 23:22 pg_ident.conf
-rw-------. 1 postgres postgres  4476 Jan 18 23:22 pg_hba.conf

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

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

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

psql -U postgres -c 'SHOW config_file'

Run

sudo updatedb

紧随其后的是

locate postgresql.conf