[英]psql: FATAL: password authentication failed
When ever I am trying to run psql in the command line, it is asking for a Password:
.当我尝试在命令行中运行 psql 时,它要求输入
Password:
。
I'm not too sure what the username and password is.我不太确定用户名和密码是什么。
I installed postgresql by brew install postgres
我通过
brew install postgres
pg_hba.conf 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
Let me know if there is any confusion in my question.如果我的问题有任何混淆,请告诉我。
In other posts, it mentions if I change pg_hba.conf file to local all all trust
, I shouldn't require a password.在其他帖子中,它提到如果我将 pg_hba.conf 文件更改为
local all all trust
,我不应该需要密码。 But it is still requesting for a password.但它仍然要求输入密码。
When I run brew info postgres
当我运行
brew info postgres
I've followed the steps from Postgresql: password authentication failed for user "postgres" , but i'm still having the same issue.我已经按照Postgresql: password authentication failed for user "postgres" 中的步骤操作,但我仍然遇到同样的问题。 I added the line
我添加了该行
local all postgres ident
If you want to create a new database account from you own OS account use:如果要从自己的操作系统帐户创建新的数据库帐户,请使用:
/usr/local/bin/createdb someusername
See if this works.看看这是否有效。 Also this other SO Question might help.
另外这个其他SO问题可能会有所帮助。
Edit:编辑:
Use brew info postgres
for more information about your version.使用
brew info postgres
获取有关您的版本的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.