【问题标题】:PostgreSQL password authentication failed for user "user"用户“user”的 PostgreSQL 密码认证失败
【发布时间】:2018-04-21 19:11:21
【问题描述】:

我已经尝试谷歌这个问题很长时间了,但我似乎没有找到解决方案。

我已经在 Windows 上下载了 PostgreSQL,因此有一个用户为 username: postgrespassword: postgres

使用命令行连接没有问题:psql -U postgres

问题是当我尝试通过psql 或使用带有npm run start 的api 登录时。我尝试设置PG_URL=postgres://postgres:postgres@localhost/postgres,因为我在这个api中使用它。

然后我收到错误消息:psql: FATAL: password authentication failed for user "username on my windows computer"

在设置这个数据库或服务器时,我根本没有在计算机上使用我的用户名,所以我不知道该怎么办。当我尝试通过 psql 登录时,我能想到的密码都不正确。

This is how the pgAdmin4 page looks like

【问题讨论】:

  • 正在为同样的问题苦苦挣扎——您找到原因了吗?
  • 差不多两年后才意识到这一点——你曾经解决过这个问题吗?跳出来的一件事是工作选项psql -U postgres 省略了密码;根据您的 pg_hba.conf 配置,您的服务器可以设置为拒绝基于密码的身份验证,但允许其他身份验证方法,如信任(postgresql.org/docs/current/auth-pg-hba-conf.htmlauth_method 部分)。

标签: windows postgresql authentication sequelize.js postgresql-10


【解决方案1】:

面临完全相同的问题,此处提供的答案解决了它solution。只需在命令提示符下运行 set PGUSER=postgres ,下次您运行 psql 时,您输入的 username=postgres 密码应该可以使用。

【讨论】:

    猜你喜欢
    • 2021-12-23
    • 1970-01-01
    • 2015-12-16
    • 2019-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多