PostgreSQL的远端配置

来源:互联网 发布:等基础设施网络建设 编辑:程序博客网 时间:2024/06/11 15:08

实验

想自己搭个PostgreSQL做实验。
下载的win版数据库(postgresql-9.4.15-1-windows-x64.exe) + navicat120_pgsql_en_x64.exe。
安装完postgresql, 在本地,用自带的pgAdminIII 是可以查询数据库的,但是用wireshake抓不到包,估计没走socket,而是直接走的dll接口。
在另外一台实验机上,装navicat120_pgsql,却连不上数据库。
同事去查了资料,要改postgresql的配置文件C:\Program Files\PostgreSQL\9.4\data\pg_hba.conf.
将数据库所在的计算机ip, 作为服务器IP加入监听才行。

# TYPE  DATABASE        USER            ADDRESS                 METHOD# IPv4 local connections:host    all             all             127.0.0.1/32            md5# @note this is the db ip from remote connect!host    all             all             192.168.66.66/24        md5# IPv6 local connections:host    all             all             ::1/128                 md5# Allow replication connections from localhost, by a user with the# replication privilege.#host    replication     postgres        127.0.0.1/32            md5#host    replication     postgres        ::1/128                 md5

这时,远端的navicat120_pgsql再连接192.168.66.66的端口5432,就可以访问postgresql数据库了。

原创粉丝点击