我最近在Ubuntu上安装了PostgreSQL和EnterpriseDB包。我可以连接到本地数据库,但我不能配置它,因为我找不到配置文件。我搜索了整个硬盘驱动器,只找到了像pg_hba.conf.sample这样的样本
PostgreSQL .conf文件在哪里?
我最近在Ubuntu上安装了PostgreSQL和EnterpriseDB包。我可以连接到本地数据库,但我不能配置它,因为我找不到配置文件。我搜索了整个硬盘驱动器,只找到了像pg_hba.conf.sample这样的样本
PostgreSQL .conf文件在哪里?
当前回答
在MacOS Mojave上,我使用brew install postgresql来安装,我在这里找到了它
/ usr / local / var / postgres - postgresql上。
我得到了这个使用下面的sql命令引用在这里的响应:
psql -U postgres -c 'SHOW config_file'
其他回答
打印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';"
在MacOS Mojave上,我使用brew install postgresql来安装,我在这里找到了它
/ usr / local / var / postgres - postgresql上。
我得到了这个使用下面的sql命令引用在这里的响应:
psql -U postgres -c 'SHOW config_file'
在Mac OS X上:
sudo find / -name postgresql.conf
您可以通过下面的命令找到其他的conf文件:
sudo find / -name pg\*.conf
注:参见用法using man:
man find
如果你在docker容器中有postgres,可能你正在绑定。conf文件,要找到你在docker外部使用的。conf文件,运行docker inspect postgres11或postgres容器名称或id。该命令返回一个json,查找类似于
"HostConfig": {
"Binds": [
"/home/my_user/postgres11/:/var/lib/postgresql/data"
]
如果执行SHOW config_file;结果在/var/lib/postgresql/data/postgresql.conf中,那么你就知道外面的。conf文件在/home/my_user/postgres11/postgresql.conf中,或者结果在属性" bindings "中
Run
sudo updatedb
紧随其后的是
locate postgresql.conf