PostgreSQL开启远程连接

需要修改两个文件:

pg_hba.conf

postgresql.conf

1.修改pg_hba.conf文件

在IPv4下面添加:host    all             all             192.168.1.0/24          md5

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust

host    all             all             192.168.1.0/24          md5

在文件最下面添加

host    all             all              0.0.0.0/0              md5

 

2.修改postgresql.conf

#listen_addresses = 'localhost'  改成  listen_addresses = '*'

 

3.重启postgresql服务

 

 

你可能感兴趣的:(postgresql)