postgres 8.3 中的密码不起作用
我已经安装了postgres 8.3,我在安装时输入了test作为密码...我的问题是每次我尝试访问本地数据库...每次我输入密码...它说数据库连接失败.. .我尝试通过命令行更改密码,但它不起作用...甚至尝试更改配置文件...它不起作用...我有什么方法可以使数据库工作吗?谢谢你的回复...
i have installed postgres 8.3, i entered test as the password while the installation...my problem is that each time i try to access the local database...each time i enter the password...it say database connecting failed...i have tried to change the password via command line but it does not work...even tried to change the configuration file...it does not work...is there any way out for me to make the database work? thanks for your reply...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
人们通常无法使用密码连接到 postgres,因为它默认配置为对本地连接使用 ident 身份验证。尝试切换到 postgres 系统帐户并使用该用户名进行连接。如果您在没有密码的情况下进入,则您已配置为身份。您还可以检查 pg_hba.conf 中的身份验证方法。
如果您想切换为使用密码进行本地连接,可以修改 pg_hba.conf 中的设置。在文件的底部有一个像这样的部分:
您可以在第二个“本地”行上看到我已将设置更改为使用 md5 身份验证而不是 ident sameuser。这允许我使用正确的密码从我的系统帐户以任何数据库用户身份登录。如果您进行相同的更改并重新启动 postgres,可能会解决您的问题。
小心不要更改第一条“本地”行。 postgres 用户是超级用户,如果您更改该身份验证机制,您可能无法进入。
Often people cannot connect to postgres with a password because it is configured by default to use ident authentication for local connections. Try switching to the postgres system account and connecting with that username. If you get in without a password you're configured for ident. You can also check the authentication methods in pg_hba.conf.
If you want to switch to using passwords for local connections, you can modify the setting in pg_hba.conf. At the bottom of the file there's a section like this:
You can see on the second "local" line I have changed my setting to use md5 authentication instead of ident sameuser. That allows me to log in as any database user from my system account by using the correct password. If you make the same change and restart postgres that might solve your problem.
Be careful not to change the first "local" line. The postgres user is the super user and if you change that authentication mechanism you may not be able to get in.
除了有关编辑 pg_hba.conf 的评论之外,我还必须为自己设置一个密码,就像在这个线程
http://ubuntuforums.org/showthread.php?t=388632
使用
In addition to the comment about editing pg_hba.conf, I also had to set a password for myself like in this thread
http://ubuntuforums.org/showthread.php?t=388632
using