【问题标题】:Postgres: Cannot connect from NodeJS (PG) with md5Postgres:无法使用 md5 从 NodeJS (PG) 连接
【发布时间】:2016-06-24 20:28:26
【问题描述】:

Windows 10 上的节点 v6.2; PG (node-postgres) v4.4.2

Ubuntu 14.04 Trusty VirtualBox 上的 Postgres 9.5

我正在使用 PG (node-postgres) 模块在虚拟机中连接到 Ubuntu 上的 Postgres。我能够使用 Navicat 连接没有问题,但是当我使用 NodeJS 连接时,这些相同的凭据不起作用。 postgres 日志显示:

xxxx@yyyy FATAL:  password authentication failed for user "xxxx"
xxxx@yyyy DETAIL:  Connection matched pg_hba.conf line 96: "host    all             all             all        $

我将此行添加到我的 pg_hba.conf 文件中,现在它可以工作了,但谁能解释为什么 md5 不工作?

# I added this line:
host    all             all             all                     password
# This line was already here:
host    all             all             all                     md5

【问题讨论】:

  • 你的Node.js和node-postgres是什么版本的?

标签: node.js postgresql node-postgres


【解决方案1】:

Node v6 中有一个重大更改,因此您需要将“pg”(node-postgres)从您说正在使用的 v4.4.2 升级到 v6.0.1。

https://github.com/brianc/node-postgres/issues/1000

【讨论】:

    猜你喜欢
    • 2017-10-06
    • 1970-01-01
    • 2020-02-21
    • 2019-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-15
    • 1970-01-01
    相关资源
    最近更新 更多