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

PostgreSQL .conf文件在哪里?


当前回答

打印pg_hba.conf文件位置:

su - postgres -c "psql -t -P format=unaligned -c 'show hba_file';"

打印postgresql.conf文件位置:

su - postgres -c "psql -t -P format=unaligned -c 'SHOW config_file';"

其他回答

我把它定位在这里:

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

Run

sudo updatedb

紧随其后的是

locate postgresql.conf

或者问问你的数据库:

$ psql -U postgres -c 'SHOW config_file'

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

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

在ubuntu中,你可以找到

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

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

service postgresql restart

打印pg_hba.conf文件位置:

su - postgres -c "psql -t -P format=unaligned -c 'show hba_file';"

打印postgresql.conf文件位置:

su - postgres -c "psql -t -P format=unaligned -c 'SHOW config_file';"