我最近在Ubuntu上安装了PostgreSQL和EnterpriseDB包。我可以连接到本地数据库,但我不能配置它,因为我找不到配置文件。我搜索了整个硬盘驱动器,只找到了像pg_hba.conf.sample这样的样本
PostgreSQL .conf文件在哪里?
我最近在Ubuntu上安装了PostgreSQL和EnterpriseDB包。我可以连接到本地数据库,但我不能配置它,因为我找不到配置文件。我搜索了整个硬盘驱动器,只找到了像pg_hba.conf.sample这样的样本
PostgreSQL .conf文件在哪里?
当前回答
Run
sudo updatedb
紧随其后的是
locate postgresql.conf
其他回答
答案可能是您还没有初始化数据库。在安装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 /]#
要获得pg_hba.conf文件的位置,还可以像这样查询数据库
SHOW hba_file;
你应该买
hba_file
---------------------------------
/var/lib/pgsql/data/pg_hba.conf
(1 row)
Fedora 20
$ cd /var/lib/pgsql/data
$ ls -ltr *.conf
-rw-------. 1 postgres postgres 20453 Jan 18 23:22 postgresql.conf
-rw-------. 1 postgres postgres 1636 Jan 18 23:22 pg_ident.conf
-rw-------. 1 postgres postgres 4476 Jan 18 23:22 pg_hba.conf
在MacOS Mojave上,我使用brew install postgresql来安装,我在这里找到了它
/ usr / local / var / postgres - postgresql上。
我得到了这个使用下面的sql命令引用在这里的响应:
psql -U postgres -c 'SHOW config_file'
我的安装不是默认的,但你可以去Postgres目录,找到子目录\Data。
配置文件 C: \ Postgres \ \ postgresql.conf数据 C: \ Postgres \ \ pg_hba.conf数据