我最近在Ubuntu上安装了PostgreSQL和EnterpriseDB包。我可以连接到本地数据库,但我不能配置它,因为我找不到配置文件。我搜索了整个硬盘驱动器,只找到了像pg_hba.conf.sample这样的样本
PostgreSQL .conf文件在哪里?
我最近在Ubuntu上安装了PostgreSQL和EnterpriseDB包。我可以连接到本地数据库,但我不能配置它,因为我找不到配置文件。我搜索了整个硬盘驱动器,只找到了像pg_hba.conf.sample这样的样本
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
其他回答
Run
sudo updatedb
紧随其后的是
locate postgresql.conf
nantha=# SHOW config_file;
config_file
/var/lib/postgresql/data/postgresql.conf (1 行)
nantha=# SHOW hba_file;
hba_file
/var/lib/postgresql/data/pg_hba.conf (1 行)
在MacOS Mojave上,我使用brew install postgresql来安装,我在这里找到了它
/ usr / local / var / postgres - postgresql上。
我得到了这个使用下面的sql命令引用在这里的响应:
psql -U postgres -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
我喜欢这个线程,因为它记录了不同架构上各种postgresql.conf文件的默认位置…
但是,我也遇到了麻烦,因为我在安装时依赖这些默认值,而这些默认值已经指定了备用位置。一种方法是通过直接查询数据库来查找特定配置文件的位置:
Select * from pg_settings where name='config_file'
删除where子句以查看所有设置,这也很有启发性,因为它显示了数据目录、pg_hba.conf等的位置。