Postgres在linux中查找配置文件

问题描述 投票:0回答:2

我花了很多时间在 不同的 Linux 发行版 以及

postgres 版本
本身中找到
Postgres
配置文件,如 pg_hba.confpostgresql.conf!我很困惑......

postgresql postgresql-9.1 postgresql-9.6 pg-hba.conf
2个回答
17
投票

终于找到了全局解决方案

首先,您应该遵循以下步骤:

  1. 类型

    su - postgres
    ,或者,如果这不起作用,
    sudo -i -u postgres
    并点击
    Enter

  2. 键入

    psql
    并点击
    Enter

  3. 要找出 postgres 配置文件的位置

    postgresql.conf
    ,请键入:

    SHOW config_file;
    

    输出应该是这样的:

    postgres=# SHOW config_file;
                   config_file               
    -----------------------------------------
     /etc/postgresql/9.6/main/postgresql.conf
    (1 row)
    
  4. 要找出 postgres

    pg_hba.conf
    文件的位置,请键入:

    SHOW hba_file;
    

    那里,输出应该是这样的:

    postgres=# SHOW hba_file;
                  hba_file               
    -------------------------------------
     /etc/postgresql/9.6/main/pg_hba.conf
    (1 row)
    

3
投票

如果你的实例没有启动,你不能

select current_setting('hba_file')

select setting from pg_settings where name = 'hba_file'

psql -c 'show hba_file'

你可以找到他们:

find / -name pg_hba.conf
© www.soinside.com 2019 - 2024. All rights reserved.