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

PostgreSQL .conf文件在哪里?


当前回答

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

C:\Program Files\PostgreSQL\9.5\data

其他回答

Run

sudo updatedb

紧随其后的是

locate postgresql.conf

Ubuntu 13.04使用软件中心安装:

我的位置是:

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

或者问问你的数据库:

$ psql -U postgres -c 'SHOW config_file'

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

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

我的安装不是默认的,但你可以去Postgres目录,找到子目录\Data。

配置文件 C: \ Postgres \ \ postgresql.conf数据 C: \ Postgres \ \ pg_hba.conf数据

在linux上的默认位置是:

cd /etc/postgresql/12/main/

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