PostgeSQL 9.5 允许远程访问
2020-04-26 本文已影响0人
一剑无血冯稀饭
修改pg_hba.conf文件,一般在安装目录下
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 0.0.0.0/0 trust #此行为添加,0.0.0.0/0为所有客户端都可以连接,trust是为了默认postgres用户也可以连接
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres trust
#host replication postgres 127.0.0.1/32 trust
#host replication postgres ::1/128 trust
修改postgresql.conf文件,一般和上一个文件在同级目录下
- 将以下内容
### listen_addresses = 'localhost'
- 修改为
listen_addresses = '*'