【问题标题】:unable to connect to Postgres Facing an error psql: error: FATAL: no pg_hba.conf entry for host "10.x.x.x", user "user", database "db"无法连接到 Postgres 面临错误 psql:错误:致命:主机“10.x.x.x”、用户“user”、数据库“db”没有 pg_hba.conf 条目
【发布时间】:2021-10-27 09:05:30
【问题描述】:

您好,我正在尝试连接到 postgres 数据库,但在连接时出现错误

psql: error: FATAL:  no pg_hba.conf entry for host "10.x.x.x", user "user", database "db"

我尝试过的 我尝试配置 pg_hba.conf 文件,我正在使用打开的 vpn 进行连接,我在 pg_hba.conf 文件中进行了这些更改,如下面的截图所示。

我在 cmd 提示符下运行以下命令

psql -h hostaddress -p 5432 -U username -d databasename

【问题讨论】:

  • x* 是同一个东西吗?

标签: postgresql openvpn


【解决方案1】:

您的 pg_hba.conf 中的地址条目无效。地址条目应如下所示(IP 地址中没有 * 占位符):

host all all 127.0.0.1/32 md5

对于您的 VPN 子网(假设 A 类专用网络和子网掩码为 255.0.0.0),条目应如下所示:

host all all 10.0.0.0/8 md5

另请参阅 pg_hba.conf 的 documentation 中的示例。

【讨论】:

    猜你喜欢
    • 2020-05-19
    • 2021-06-04
    • 1970-01-01
    • 2022-01-24
    • 1970-01-01
    • 2014-09-19
    • 2013-10-19
    • 2014-10-27
    相关资源
    最近更新 更多