加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgresql – Postgres:尝试使用不同的unix用户登录时身份验证

发布时间:2020-12-13 16:06:52 所属栏目:百科 来源:网络整理
导读:我有一个用户hduser和用户postgres, 与hduser: hduser@master:/$psql -Upostgres -W analyticsPassword for user postgres: psql: FATAL: Ident authentication failed for user "postgres"hduser@master:/$ 与postgres: postgres@master:/opt/pentaho/bis
我有一个用户hduser和用户postgres,

与hduser:

hduser@master:/$psql -Upostgres -W analytics
Password for user postgres: 
psql: FATAL:  Ident authentication failed for user "postgres"
hduser@master:/$

与postgres:

postgres@master:/opt/pentaho/biserver-ce$psql -Upostgres -W analytics
Password for user postgres: 
psql (8.4.9)
Type "help" for help.

analytics=#

如何使用其他用户(如hduser或其他用户)登录同一数据库?

谢谢

解决方法

PostgreSQL的默认配置仅允许对数据库用户进行“本地”访问,这些用户与OS用户具有相同的名称. “local”表示仅使用Unix-Domain套接字而没有任何IP流量.请参阅配置文件pg_hba.conf的文档,尤其是以“local”开头的行和身份验证方法“peer”或“ident”.

另一方面,默认情况下,使用IP传输通道访问postgres,如果有密码,则使用密码.因此,这应该可以帮助普通用户.

foouser@host$psql -U baruser -h 127.0.0.1 database

坏消息是,DB超级用户postgres默认没有密码,所以你必须先设置一个.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读