Lion 下的 PostgreSQL:密码是什么?
我得到了我的新狮子机。从适用于 Mac 的 PostgreSQL 站点运行 PostgreSQL 安装程序,我没有安装多个应用程序。其中之一是“pgAdmin III.app”。当我打开它时,已经有一个可用的服务器连接。 localhost:5432
每当我尝试双击连接到服务器时,程序都会要求我输入密码。我不知道该输入什么。这不是我的管理员密码,不是“postgres”,不是“localhost”,也不是空的。
我似乎无法连接到服务器。即使当我检查本地主机服务器的属性时,密码字段似乎为空。但是我不允许将密码字段留空。
知道该怎么做吗?我真的需要设置 postgres 吗?
I got my new lion machine. Ran the PostgreSQL installer from the PostgreSQL site for Mac and i have no multiple apps installed. One of them is "pgAdmin III.app". When I open it there is already one server connection available. localhost:5432
Whenever I try to connect to the server with a doubleclick the programm asks me for a password. I have no idea what to enter. It's not my admin password, it's not "postgres", it's not "localhost", it's not empty.
I just can't seem to connect to the server. Even when I check the properties of the localhost server the password field seems empty. However I'm not allowed to leave the password field empty.
Any idea what to do? I really need to setup postgres?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在我的 Mac OSX Lion 上,PostgreSQL 配置文件存储在
/Library/PostgreSQL/9.0/data/
下On my Mac OSX Lion, PostgreSQL configuration files are stored under
/Library/PostgreSQL/9.0/data/
尚未在 OSX 上尝试过,但在 Ubuntu 上,您可以以系统用户“postgres”身份登录默认数据库“postgres”,无需密码,
然后您可以(重新)设置数据库超级用户“postgres”的密码。
您还可以编辑配置文件
pg_hba.conf
(不知道它在默认 OSX 安装上的位置,在 Ubuntu 上它是/etc/postgresql/8.4/main/pg_hba.conf)。 编辑pg_hba.conf
后,您必须使用 pg_hba.conf 重新加载配置,
然后可以使用 pgAdmin 连接并(重新)设置密码,但不要忘记更改身份验证方法后退再次到
md5
...Haven't tried it on OSX, but on Ubuntu you can login as the system user 'postgres' to the default database 'postgres' without a password with
You can then (re)set the password of the database superuser 'postgres'.
You can also edit the configuration file
pg_hba.conf
(don't know where it is located on a default OSX installation, on Ubuntu it is/etc/postgresql/8.4/main/pg_hba.conf
) and grant access to the default database without authenticationAfter editing pg_hba.conf you must reload the configuration with
You can then connect with pgAdmin and (re)set the password, but don't forget to change the authentication method back to
md5
again...这里有一个更好的答案(适用于 OSX HighSierra):使用的帐户是您登录 OSX 的帐户,因此,密码就是您的密码!
here's a better answer (works in OSX HighSierra): the account used is the one you're logged onto OSX with, therefore, the password is your password!
不久前也有人问过类似的问题。那里描述的步骤也应该适用于 Lion。
Postgresql:用户“postgres”的密码身份验证失败
A similar question has been asked a short time ago. The steps described there should be appropriate for Lion also.
Postgresql: password authentication failed for user "postgres"