【发布时间】:2018-04-21 19:11:21
【问题描述】:
我已经尝试谷歌这个问题很长时间了,但我似乎没有找到解决方案。
我已经在 Windows 上下载了 PostgreSQL,因此有一个用户为 username: postgres 和 password: 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 登录时,我能想到的密码都不正确。
【问题讨论】:
-
正在为同样的问题苦苦挣扎——您找到原因了吗?
-
差不多两年后才意识到这一点——你曾经解决过这个问题吗?跳出来的一件事是工作选项
psql -U postgres省略了密码;根据您的 pg_hba.conf 配置,您的服务器可以设置为拒绝基于密码的身份验证,但允许其他身份验证方法,如信任(postgresql.org/docs/current/auth-pg-hba-conf.html、auth_method部分)。
标签: windows postgresql authentication sequelize.js postgresql-10