首页 > 代码库 > 【转】PostgreSQL IP地址访问配置
【转】PostgreSQL IP地址访问配置
原文:http://blog.csdn.net/shuaiwang/article/details/1793294
1.PostgreSQL的安装目录,进入data文件夹,打开postgresql.conf文件,修改listen_addresses,如下
# - Connection Settings -
listen_addresses = ‘localhost,123.123.123.123‘ # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to ‘localhost‘, ‘*‘ = all
# (change requires restart)
port = 5432 # (change requires restart)
listen_addresses = ‘localhost,123.123.123.123‘ # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to ‘localhost‘, ‘*‘ = all
# (change requires restart)
port = 5432 # (change requires restart)
注意:这里的‘123.123.123.123‘改称你的IP。
2- 也是在data文件夹下,打开pg_hba.conf文件,修改如下:
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all postgres 123.123.0.0/16 password
# IPv6 local connections:
#host all all ::1/128 md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all postgres 123.123.0.0/16 password
# IPv6 local connections:
#host all all ::1/128 md5
注意:这里的‘123.123.0.0/16‘是你允许访问你的数据库的网络,password是指连接连接数据库时需要密码;postgres是指用户名,all是指所有数据库~
3- 到控制面板-管理工具-服务中,重新启动PostgreSQL服务
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。