为什么Mac上的postgresql全新安装后要求我提供密码? [英] Why postgresql on mac asks me for password after fresh install?
问题描述
我刚刚在Macbook上安装了 postgresql
,并用 brew install postgresql
。然后,我尝试使用 psql
,但是它要求输入密码,然后显示 psql:FATAL:用户< myname>的密码验证失败。
I just installed postgresql
on a Macbook with brew install postgresql
. Then I try to psql
, but it requires password and then show psql: FATAL: password authentication failed for user "<myname>"
.
我还没有设置任何东西,输入我的mac密码也无济于事。我现在应该怎么办?
I have not set up anything, and inputting my mac password does nothing. What should I do now?
推荐答案
所以您的用户名可能不存在,因为数据库附带的默认用户名是 postgres
。
So your username probably does not exist, as the default username that ships with the db is postgres
.
此外,我无法提交空密码,对于 postgres
用户,默认密码为空。
Further, I was prevented from the submission of an empty password, which is blank by default for the postgres
user.
您可以尝试
cd ~/
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
Password: YOUR_LOGIN_PWD_HERE (required for sudo)
然后使用
psql -U postgres
password: postgres
我不确定100%我从哪个答案中得到了答案,也许是在这里。希望这可以帮助。
I'm not 100% sure of which SO answer I got this from, perhaps here. Hope this helps.
这篇关于为什么Mac上的postgresql全新安装后要求我提供密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!