gpt4 book ai didi

postgresql - psql : FATAL: Ident authentication failed for user "xxx" with method trust

转载 作者:行者123 更新时间:2023-12-05 01:20:31 25 4
gpt4 key购买 nike

我通过以下方式(使用 postgres 用户)创建了一个新角色和数据库:

CREATE ROLE xxx LOGIN
PASSWORD 'CHOOSEAPASSWORD'
NOSUPERUSER INHERIT NOCREATEDB CREATEROLE REPLICATION;

CREATE DATABASE xxx
WITH OWNER = xxx
ENCODING = 'UTF8'
TABLESPACE = pg_default
CONNECTION LIMIT = -1;

\connect xxx
GRANT ALL ON DATABASE xxx TO xxx;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO xxx;

在 pg_hba.conf 中,我有以下条目:

local   all             postgres                                trust
local all all peer
# IPv4 local connections:
host all xxx 127.0.0.1/32 trust
host all all 127.0.0.1/32 ident

但是我无法连接

psql -U xxx -h localhost -W

得到错误

psql: FATAL:  Ident authentication failed for user "xxx"

我有什么可能出错的想法吗? (我使用的是 PostgreSQL 9.4 和 CentOS 6.7)

最佳答案

尝试使用 127.0.0.1 而不是 localhost

关于postgresql - psql : FATAL: Ident authentication failed for user "xxx" with method trust,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32379034/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com