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

PostgreSQL .conf文件在哪里?


当前回答

我把它定位在这里:

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

其他回答

或者问问你的数据库:

$ psql -U postgres -c 'SHOW config_file'

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

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

我把它定位在这里:

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

Win7, version 10位置:

C:\Program Files\PostgreSQL\10\postgresql.conf

除了直接的答案,你可能还想看看关于Postgres配置文件位置的文档。

在大多数情况下:在$PGDATA下,通常是/var/lib/postgresql/data或类似的路径(如果使用Docker映像,至少它是默认路径)。

Ubuntu 13.04使用软件中心安装:

我的位置是:

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