我最近在Ubuntu上安装了PostgreSQL和EnterpriseDB包。我可以连接到本地数据库,但我不能配置它,因为我找不到配置文件。我搜索了整个硬盘驱动器,只找到了像pg_hba.conf.sample这样的样本

PostgreSQL .conf文件在哪里?


当前回答

在linux上的默认位置是:

cd /etc/postgresql/12/main/

12-version 根据安装版本不同,版本可能不同

其他回答

在Mac上(使用brew安装Postgres):

/usr/local/Cellar/postgresql/9.3.3>bin/postgres -D /usr/local/var/postgres/

在linux上的默认位置是:

cd /etc/postgresql/12/main/

12-version 根据安装版本不同,版本可能不同

Ubuntu 13.04使用软件中心安装:

我的位置是:

/etc/postgresql/9.1/main/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 行)

对于ubuntu 18/20,执行以下命令找到postgresql.conf文件:

locate postgresql.conf

如果你的linux中没有locate,那么先运行sudo apt-get install locate来安装locate。