【问题标题】:Why psql doing nothing with -h param?为什么 psql 对 -h 参数什么都不做?
【发布时间】:2020-03-17 06:43:02
【问题描述】:

我已经安装了postgres,然后我在pg_hba.conf中创建了新用户并在127.0.0.1上打开了md5认证

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

但是现在如果我尝试通过带有“-h”标志和“127.0.0.1”的 psql 连接,而这个用户 psql 什么都不做。

-bash-4.2$ psql -h 127.0.0.1 -U k4fntr

只是冻结

【问题讨论】:

  • 如果你ssh root@127.0.0.1,你会看到类似的效果吗?

标签: postgresql psql


【解决方案1】:

问题出在 iptables 上。我发现我对 iptables 中的 postgres 没有任何了解。

此命令已解决问题

iptables -I INPUT -p tcp -m tcp -s 127.0.0.1 --dport 5432 -j ACCEPT

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-13
    • 2019-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多