【问题标题】:Unable to connect from local psql to postgresql using ip address无法使用 ip 地址从本地 psql 连接到 postgresql
【发布时间】:2020-03-01 06:40:37
【问题描述】:

我正在尝试从 psql 会话连接到本地运行的 postgresql

psql -h 192.168.195.84 -d aact_bac

pg_hba.conf 条目是:

host    all             all             0.0.0.0/0                   md5
host    all             all             192.168.195.84/0            md5

结果如下:

psql: FATAL:  psql: FATAL:  no pg_hba.conf entry for host "192.168.195.84", 
user "pointr", database "aact_back", SSL o for host "192.168.195.84", 
user "pointr", database "aact_back", SSL o

这里缺少什么?

更新以下操作已多次执行 - 在每次尝试更改 pg_hba.conf 之后:

sudo service postgresql restart

ps -ef | grep postgres查看启动时间,确认pg服务器已经重启。

【问题讨论】:

  • 您没有指定掩码长度192.168.195.84/32。也不要忘记重新加载。
  • 所以“本地”不代表“本地主机”?
  • 假设postgresql 10或更新版本,你能检查select * from pg_hba_file_rules的结果吗

标签: postgresql


【解决方案1】:

这是最适合您的答案,如果有效,这是重复的答案。 如果你不发表评论。 :D

我想这是你错过了。

# content in pg_hba.conf

# IPv4 local connections:
host all all 0.0.0.0/0 md5

Remote PostgreSQL connection with pgAdmin

【讨论】:

  • 谢谢 - 我实际上已经有了那个条目:将添加到问题中
猜你喜欢
  • 2011-06-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多