难以连接到PostgreSQL@localhost使用节点postgress(错误:28000)

难以连接到PostgreSQL@localhost使用节点postgress(错误:28000),postgresql,node-postgres,Postgresql,Node Postgres,我目前正在rPi3B+(aarch64)上运行openSuse,并且在运行NodeJS连接脚本时遇到了麻烦 我完成了PostgreSQL的标准安装(v10是这个版本的openSuse提供的),然后用创建了一个新角色 CREATE ROLE new_role LOGIN PASSWORD 'passwd'; 然后是一个带有 CREATE DATABASE new_db OWNER new_role; \l和\du都返回预期的输出,表明角色和数据库都已成功创建,拥有正确的所有者 因此,我随后快速

我目前正在rPi3B+(aarch64)上运行openSuse,并且在运行NodeJS连接脚本时遇到了麻烦

我完成了PostgreSQL的标准安装(v10是这个版本的openSuse提供的),然后用创建了一个新角色

CREATE ROLE new_role LOGIN PASSWORD 'passwd';
然后是一个带有

CREATE DATABASE new_db OWNER new_role;
\l
\du
都返回预期的输出,表明角色和数据库都已成功创建,拥有正确的所有者

因此,我随后快速创建了一个节点项目目录,并从文档中复制了测试脚本:

这将返回一些我尚未正确捕获的违反承诺的错误(
.cath()
),以及一个28000的错误代码,如下所示:

{ error: Ident authentication failed for user "new_role"
at Connection.parseE (/home/eru/postgresDB/node_modules/pg/lib/connection.js:554:11)
at Connection.parseMessage (/home/eru/postgresDB/node_modules/pg/lib/connection.js:379:19)
at Socket.<anonymous> (/home/eru/postgresDB/node_modules/pg/lib/connection.js:119:22)
at Socket.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
at Socket.Readable.push (_stream_readable.js:219:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
  name: 'error',
  length: 99,
  severity: 'FATAL',
  code: '28000',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'auth.c',
  line: '328',
  routine: 'auth_failed' } undefined
{错误:用户“新角色”的身份验证失败
在Connection.parseE(/home/eru/postgresDB/node_modules/pg/lib/Connection.js:554:11)
在Connection.parseMessage(/home/eru/postgresDB/node_modules/pg/lib/Connection.js:379:19)
在套接字上。(/home/eru/postgresDB/node_modules/pg/lib/connection.js:119:22)
在Socket.emit(events.js:182:13)
在addChunk(_stream_readable.js:283:12)
在readableAddChunk(_stream_readable.js:264:11)
在Socket.Readable.push(_stream_Readable.js:219:10)
在TCP.onStreamRead[as onread](internal/stream_base_commons.js:94:17)
名称:“错误”,
长度:99,
严重程度:“致命”,
代码:“28000”,
细节:未定义,
提示:未定义,
位置:未定义,
内部位置:未定义,
internalQuery:未定义,
其中:未定义,
模式:未定义,
表:未定义,
列:未定义,
数据类型:未定义,
约束:未定义,
文件:“auth.c”,
行:“328”,
例程:“身份验证失败”}未定义
因此,我非常确定尝试到达了预期的端口,否则我就不会在终端中收到详细的错误。错误代码=
无效的授权规范

在服务器,
psql
接口上是否需要执行一些操作,以满足授权规范

当我研究过那个具体的问题时,我似乎找不到与我的情况相关的有用的搜索结果


这里的博士后都是新手,所以我确信这是一个我所错过的错误,但任何帮助或意见都非常感谢

在这里进一步挖掘后找到了答案:

最后从
ident
方法到
md5

这是相当粗糙的,因为除了告诉postgreSQL检查md5加密密码,而不是检查我的用户名是否与服务器上创建的角色匹配之外,我真的不明白我改变了什么

如果有人对发生了什么变化以及为什么我洗耳恭听有一个恰当的解释

{ error: Ident authentication failed for user "new_role"
at Connection.parseE (/home/eru/postgresDB/node_modules/pg/lib/connection.js:554:11)
at Connection.parseMessage (/home/eru/postgresDB/node_modules/pg/lib/connection.js:379:19)
at Socket.<anonymous> (/home/eru/postgresDB/node_modules/pg/lib/connection.js:119:22)
at Socket.emit (events.js:182:13)
at addChunk (_stream_readable.js:283:12)
at readableAddChunk (_stream_readable.js:264:11)
at Socket.Readable.push (_stream_readable.js:219:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
  name: 'error',
  length: 99,
  severity: 'FATAL',
  code: '28000',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'auth.c',
  line: '328',
  routine: 'auth_failed' } undefined