我最近在Ubuntu上安装了PostgreSQL和EnterpriseDB包。我可以连接到本地数据库,但我不能配置它,因为我找不到配置文件。我搜索了整个硬盘驱动器,只找到了像pg_hba.conf.sample这样的样本
PostgreSQL .conf文件在哪里?
我最近在Ubuntu上安装了PostgreSQL和EnterpriseDB包。我可以连接到本地数据库,但我不能配置它,因为我找不到配置文件。我搜索了整个硬盘驱动器,只找到了像pg_hba.conf.sample这样的样本
PostgreSQL .conf文件在哪里?
当前回答
我的安装不是默认的,但你可以去Postgres目录,找到子目录\Data。
配置文件 C: \ Postgres \ \ postgresql.conf数据 C: \ Postgres \ \ pg_hba.conf数据
其他回答
Run
sudo updatedb
紧随其后的是
locate postgresql.conf
在Mac OS X上:
sudo find / -name postgresql.conf
您可以通过下面的命令找到其他的conf文件:
sudo find / -name pg\*.conf
注:参见用法using man:
man find
对于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
如果您遵循亚马逊发布的在AWS上安装Postgresql的白皮书,其中包括在挂载在独立EBS卷上的文件系统上创建/data/目录,那么您的Postgresql .conf文件位于/data/
从中我得出结论,文件是在初始化数据目录期间创建的,并驻留在数据目录的根目录中。对于默认安装,这似乎是/var/lib/pgsql/data,但如果您移动了数据目录则不是
打印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';"