当前位置:   article > 正文

pg数据库开启远程连接_PostgreSQL 允许远程访问设置的操作

# type database user address method # ipv4 local connections: host all all 0

postgres远程连接方式配置

配置pg_hba.conf文件 目录C:Program FilesPostgreSQL9.5data

(QXY)主机

[postgres@qxy data]$ pwd

/spark/pgsql/data

[postgres@qxy data]$ cat 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

# IPv6 local connections:

host all all ::1/128 trust

在# IPv4 local connections:

下面添加一行,内容为 “host all all 192.168.40.1/24 md5”,代表192.168.40网段的IP地址的所有用户都可以连接,/24代表网段,如果是/32 需要写完整的IP地址

添加之后的内容如下:

# “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 192.168.40.1/24 md5

2. 修改postgres监听的IP地址,默认是localhost ---------- 有时候默认就是O

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/690128
推荐阅读
相关标签
  

闽ICP备14008679号