本地数据库安装,默认使用localhost
连接,使用ip
连接报错问题?
- 找到数据库安装的路径,在
data
文件夹下找到pg_hba.conf
修改地址访问配置
# TYPE DATABASE USER ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 192.168.0.0/0 md5
# IPv6 local connections:
host all all ::1/128 md5
host all all 192.168.0.0/0 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
host all all 192.168.0.0/0 md5
在IPv6
处添加
host all all 192.168.0.0/0 md5
- 进入命令控制行输入
services.msc
找到数据库服务重启即可