我最近在Ubuntu上安装了PostgreSQL和EnterpriseDB包。我可以连接到本地数据库,但我不能配置它,因为我找不到配置文件。我搜索了整个硬盘驱动器,只找到了像pg_hba.conf.sample这样的样本
PostgreSQL .conf文件在哪里?
我最近在Ubuntu上安装了PostgreSQL和EnterpriseDB包。我可以连接到本地数据库,但我不能配置它,因为我找不到配置文件。我搜索了整个硬盘驱动器,只找到了像pg_hba.conf.sample这样的样本
PostgreSQL .conf文件在哪里?
当前回答
对于Debian 9,我使用Franke Heikens的答案- $ /etc/postgresql/9.6/main/postgresql.conf
其他回答
在linux上的默认位置是:
cd /etc/postgresql/12/main/
12-version 根据安装版本不同,版本可能不同
除了直接的答案,你可能还想看看关于Postgres配置文件位置的文档。
在大多数情况下:在$PGDATA下,通常是/var/lib/postgresql/data或类似的路径(如果使用Docker映像,至少它是默认路径)。
如果您刚刚安装了它,locate可能不起作用。在这种情况下,服务应该正在运行,您可以运行
ps aux | grep 'postgres *-D'
查看postgresql-master从哪里加载配置文件。
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
Ubuntu 13.04使用软件中心安装:
我的位置是:
/etc/postgresql/9.1/main/postgresql.conf