【问题标题】:What is the JSON schema of a loopback Datasource with PostgreSQL user that has no password?没有密码的 PostgreSQL 用户的环回数据源的 JSON 模式是什么?
【发布时间】:2018-10-08 05:34:39
【问题描述】:

LoopBack:我正在尝试使用此数据源通过 CentOS 中的数据源文件将我的数据库连接到 API:

{
  "db": {
    "name": "db",
    "connector": "memory"
  },
  "apidb": {
    "host": "localhost",
    "port": 5432,
    "url": "postgres://postgres@localhost/apidb",
    "database": "apidb",
     "password": "",
    "name": "apidb",
    "user": "postgres",
    "connector": "postgresql"
  }
}

我尝试了多次连接,但出现错误:

Web server listening at: http://localhost:3000
Browse your REST API at http://localhost:3000/explorer
Connection fails: error: Ident authentication failed for user "postgres"
It will be retried for the next request.
events.js:183
      throw er; // Unhandled 'error' event
      ^

error: Ident authentication failed for user "postgres"

当我输入su - postgres 时,我可以毫无问题地进入 bash。我有一个要连接的数据库名称apidb。到目前为止我试过了:

  1. 正在删除密码密钥。
  2. 修复不同结构的url(例如:postgres://postgres:@localhost:5432/apidb
  3. 结果here。 pg install 正在更新的位置。

以下是数据库在列出时的样子:

 apidb| postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres   
       +
             |          |          |             |             | postgres=CTc/po
stgres +

我不确定错误来自何处。帮助!

【问题讨论】:

    标签: node.js angular postgresql loopback


    【解决方案1】:

    Ident authentication method 要求您的操作系统用户名与您希望连接的 PostgreSQL 用户名匹配。如果不是这种情况,您需要选择不同的身份验证方法,或者提供一个 pg_ident.conf 将 OS 用户映射到允许的 PostgreSQL 用户。如果您打算使用 ident 但它不适合您,请查看 PostgreSQL 服务器日志文件以查看它提供的有关失败的信息。

    【讨论】:

      猜你喜欢
      • 2010-11-15
      • 1970-01-01
      • 2016-03-24
      • 2021-09-20
      • 2013-04-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-21
      相关资源
      最近更新 更多