无法登录系统用户postgres [英] Can't log into system user postgres
问题描述
我使用brew在Mac上安装了postgresql。在安装过程中,没有要求我输入postgresql的密码。现在我需要创建一个用户,但不能:
I installed postgresql on mac using brew. I wasn't asked about for the password for postgresql during the installation. Now I need to create a user and can't:
Alexs-MacBook-Air:mydir alex$ su - postgres
Password:
su: Sorry
无论我使用什么密码(包括空密码),是错的。重置它最简单的方法是什么?
Whatever password (including empty) I use, it is wrong. What's the easiest way to reset it?
推荐答案
您正试图访问名为 system 的用户 postgres
。根据您在其他答案上留下的评论,没有这样的用户。您无法更改不存在的用户的密码。
You're trying to access the system user named postgres
. According to comments you left on the other answers, there is no such user. You can't change the password of a user that doesn't exist.
也许是 _postgres
或 postgres _
?我知道OS X上的某些安装程序使用奇怪的名称。抑或是您的安装一开始就没有在您的系统上成功创建 postgres
用户,因此您无法为其设置密码?
Perhaps it's _postgres
or postgres_
? I know some installers on OS X use weird names. Or perhaps your install never successfully created a postgres
user on your system in the first place, so you can't set a password for it?
通常,您无需为此用户设置密码。您可以
sudo -u postgres psql
或您需要以 postgres
超级用户身份运行的任何命令。
or whatever command you need to run as the postgres
superuser.
请注意,您不需要 su
。
这篇关于无法登录系统用户postgres的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!