【问题标题】:Sequelize and peer authentication for Postgres?Postgres 的 Sequelize 和对等身份验证?
【发布时间】:2018-02-22 17:34:58
【问题描述】:

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

目前我们正在使用以下:

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

我也尝试了以下方法,但没有成功

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

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

SequelizeBaseError: password authentication failed for user"

谁能帮忙?

【问题讨论】:

    标签: node.js postgresql sequelize.js


    【解决方案1】:

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

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

    实际连接由包 'pg' 处理,并记录在 issue 中。

    注意,我已经对此进行了测试,可以与 pg@6.4.1 和 sequelize@4.4.2 一起使用。

    【讨论】:

      猜你喜欢
      • 2017-03-25
      • 2020-11-30
      • 2015-08-29
      • 1970-01-01
      • 1970-01-01
      • 2015-07-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多