一、修改配置文件
PostgreSQL安装路径下的data,默认安装路径:C:\Program Files\PostgreSQL\12\data
1.pg_hba.conf配置PostgreSQL数据库的访问权限
用记事本打开pg_hba.conf,在最后加上以下两句:
# TYPE DATABASE USER CIDR-ADDRESS METHOD
host all all 0.0.0.0/0 md5
2.postgresql.conf配置PostgreSQL数据库服务器的相应的参数
用记事本打开postgresql.conf,查找listen_address,将其设置为listen_address = "*"
二、设置防火墙入站规则
批处理文件命令如下:
netsh advfirewall firewall add rule name="postgresql" protocol=TCP dir=in localport=5432 action=allow