我的配置是数据库服务坐在archlinux虚拟机里面的。
1.修改虚拟机文件:/var/lib/postgres/data/postgresql.conf
字段:connections and authentications
listen_addresses = 'localhost,x.x.x.x'
#x.x.x.x需要访问的远程地址
2.修改:/var/lib/postgres/data/pg_hba.conf
# IPv4 local connections: host all all x.x.x.x/32 md5
x.x.x.x
是客户端的IP地址。
3.重启服务,使用命令:
systemctl restart postgresql.service