我最近在Ubuntu上安装了PostgreSQL和EnterpriseDB包。我可以连接到本地数据库,但我不能配置它,因为我找不到配置文件。我搜索了整个硬盘驱动器,只找到了像pg_hba.conf.sample这样的样本
PostgreSQL .conf文件在哪里?
我最近在Ubuntu上安装了PostgreSQL和EnterpriseDB包。我可以连接到本地数据库,但我不能配置它,因为我找不到配置文件。我搜索了整个硬盘驱动器,只找到了像pg_hba.conf.sample这样的样本
PostgreSQL .conf文件在哪里?
当前回答
在ubuntu中,你可以找到
/etc/postgresql/11/main/pg_hba.conf
// after change restart it otherwise it won't be work
service postgresql restart
其他回答
对于ubuntu 18/20,执行以下命令找到postgresql.conf文件:
locate postgresql.conf
如果你的linux中没有locate,那么先运行sudo apt-get install locate来安装locate。
Run
sudo updatedb
紧随其后的是
locate postgresql.conf
在Mac OS X上:
sudo find / -name postgresql.conf
您可以通过下面的命令找到其他的conf文件:
sudo find / -name pg\*.conf
注:参见用法using man:
man find
答案可能是您还没有初始化数据库。在安装postgres之后,但在初始化数据库之前,postgres*. .SQL文件将不存在。初始化数据库后,postgres*.将出现SQL文件。(Centos 6, Postgres 9.3演示在这里)
[root@localhost /]# yum -y install postgresql93 postgresql93-server
[root@localhost /]# ls /var/lib/pgsql/9.3/data/
[root@localhost /]#
[root@localhost /]# service postgresql-9.3 initdb
Initializing database: [ OK ]
[root@localhost /]# ls /var/lib/pgsql/9.3/data/
base pg_ident.conf pg_serial pg_subtrans pg_xlog
global pg_log pg_snapshots pg_tblspc postgresql.conf
pg_clog pg_multixact pg_stat pg_twophase
pg_hba.conf pg_notify pg_stat_tmp PG_VERSION
[root@localhost /]#
在ubuntu中,你可以找到
/etc/postgresql/11/main/pg_hba.conf
// after change restart it otherwise it won't be work
service postgresql restart