Postgres:无法使用 md5 从 NodeJS (PG) 连接

Postgres: Cannot connect from NodeJS (PG) with md5

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

Ubuntu14.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 v6 中有重大变化,因此您需要将 "pg" (node-postgres) 从您所说的正在使用的 v4.4.2 升级到 v6.0.1。

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