node.js - Postgres 的序列化和对等身份验证?

标签 node.js postgresql sequelize.js

我的 postgres 数据库已设置为使用对等身份验证,但我不确定如何告诉 Sequelize 使用此方法?

目前我们正在使用以下内容:

new Sequelize("postgres://127.0.0.1/dbname", {});

我还尝试了以下方法,但不起作用

new Sequelize("postgresql:///dbname?host=/var/lib/postgresql");

在这两种情况下我都会收到错误:

SequelizeBaseError: password authentication failed for user"

有人可以帮忙吗?

最佳答案

更多的探索表明以下内容可以完成这项工作:

new Sequelize('mydb', undefined, undefined, {
     host: '/var/run/postgresql',
     dialect: 'postgres'
   });

实际的连接由包“pg”处理,这记录在 issue 中。 .

注意,我已经测试过它可以与[email protected]一起使用和 [email protected] .

关于node.js - Postgres 的序列化和对等身份验证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46207155/

相关文章:

node.js - 如何在客户端(CryptoJS)和服务器(Crypto Node.js)之间建立 Diffie Hellman 连接

javascript - 模块构建失败(来自 ./node_modules/babel-loader/lib/index.js): Error: Cannot find module 'babel-preset-react'

sql - 获取列,4 个表

sql - 将Windows上的.sql文件导入到postgresql

node.js - 我可以拥有依赖于值的自定义 Sequelize 验证器吗?

node.js - SequelizeEagerLoadingError 当模型之间的关系已经被定义时

javascript - 检查用户名或电话是否已存在(正面)

javascript - Moment JS fromNow 对 map 中的所有日期返回相同的值 'A Year Ago'

node.js - 如何使用nodeJS将大数据集分段写入csv文件?

ruby-on-rails - Rails 4 postgres 全文搜索错误(范围)