【问题标题】:psql: FATAL: password authentication failedpsql:致命:密码验证失败
【发布时间】:2017-09-07 01:09:48
【问题描述】:

当我尝试在命令行中运行 psql 时,它会要求 Password:

我不太确定用户名和密码是什么。

我通过brew install postgres安装了postgresql

pg_hba.conf

# the database superuser.  If you do not trust all your local users,
# use another authentication method.


# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     AustinTruong                                trust
#host    replication     AustinTruong        127.0.0.1/32            trust
#host    replication     AustinTruong        ::1/128                 trust

如果我的问题有任何混淆,请告诉我。

编辑

在其他帖子中,它提到如果我将 pg_hba.conf 文件更改为 local all all trust,我不应该需要密码。但它仍然要求输入密码。

当我运行brew info postgres

我已经按照Postgresql: password authentication failed for user "postgres" 的步骤进行操作,但我仍然遇到同样的问题。我添加了一行

local all postgres ident

【问题讨论】:

    标签: postgresql


    【解决方案1】:

    如果您想从自己的操作系统帐户创建一个新的数据库帐户,请使用:

    /usr/local/bin/createdb someusername
    

    看看这是否有效。 Also this other SO Question might help.

    编辑:

    使用brew info postgres 了解有关您的版本的更多信息。

    【讨论】:

    • 嗯.. 当我运行该推荐时,它仍然要求输入密码。请查看我编辑的帖子。
    • 感谢您的更新,我仍然遇到同样的问题。似乎当我使用正常的 sudo 密码时它仍然不起作用。
    • 运行时得到什么:brew info postgres
    • 我还没有想出解决方案,一旦想出来我会标记为解决方案。谢谢!
    • 你好,从 2017 年开始......遇到了这个确切的问题 :(
    猜你喜欢
    • 2013-11-15
    • 2017-12-16
    • 2015-09-10
    • 1970-01-01
    • 1970-01-01
    • 2021-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多