我花了很多时间在 不同的 Linux 发行版 以及
postgres 版本本身中找到
Postgres配置文件,如
pg_hba.conf
或 postgresql.conf
!我很困惑......
终于找到了全局解决方案
首先,您应该遵循以下步骤:
类型
su - postgres
,或者,如果这不起作用,sudo -i -u postgres
并点击Enter
。
键入
psql
并点击Enter
。
要找出 postgres 配置文件的位置
postgresql.conf
,请键入:
SHOW config_file;
输出应该是这样的:
postgres=# SHOW config_file;
config_file
-----------------------------------------
/etc/postgresql/9.6/main/postgresql.conf
(1 row)
要找出 postgres
pg_hba.conf
文件的位置,请键入:
SHOW hba_file;
那里,输出应该是这样的:
postgres=# SHOW hba_file;
hba_file
-------------------------------------
/etc/postgresql/9.6/main/pg_hba.conf
(1 row)
如果你的实例没有启动,你不能
select current_setting('hba_file')
或
select setting from pg_settings where name = 'hba_file'
或
psql -c 'show hba_file'
你可以找到他们:
find / -name pg_hba.conf