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

PostgreSQL .conf文件在哪里?


当前回答

如果您刚刚安装了它,locate可能不起作用。在这种情况下,服务应该正在运行,您可以运行

ps aux  | grep 'postgres *-D'

查看postgresql-master从哪里加载配置文件。

其他回答

在CentOS 7和PostgreSQL 9.4中,它在以下目录中:

/var/lib/pgsql/9.4/data

当我以root用户登录时,我可以看到它。

Win7, version 10位置:

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

对于CentOS 6和7以及postgresql 9.2(以及以下版本,我想可能也包括Fedora和Redhat):

/ var / lib / pgsql数据

对于CentOS 6和7 postgresql 9.3或9.4(以及以上版本,我想):

/var/lib/pgsql/9.3/data
/var/lib/pgsql/9.4/data

对于Ubuntu 14和postgresql 9.3:

/etc/postgresql/9.3/main/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';"

或者问问你的数据库:

$ psql -U postgres -c 'SHOW config_file'

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

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