psql:致命错误:用户“icinga”的密码验证失败

时间:2017-07-12 12:47:48

标签: postgresql psql icinga icinga2 icingaweb2

我正在尝试在CentOS7上设置Icinga 2并遵循官方文档中提到的说明。 [https://docs.icinga.com/icinga2/latest/doc/module/icinga2/toc#!/icinga2/latest/doc/module/icinga2/chapter/getting-started][1].I已将数据库和用户创建为icinga。我面临以下问题psql:FATAL:当尝试使用以下命令导入Icinga 2 IDO模式时,用户“icinga”的密码验证失败

   export PGPASSWORD=icinga and psql -U icinga -d icinga < /usr/share/icinga2-ido-pgsql/schema/pgsql.sql

下面是我的pg_hba.conf使用

# TYPE  DATABASE        USER            ADDRESS                 METHOD
# icinga
local   icinga      icinga                            md5
host    icinga      icinga      127.0.0.1/32          md5
host    icinga      icinga      ::1/128               md5
# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            ident
# IPv6 local connections:
host    all             all             ::1/128                 ident
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#host    replication     postgres        127.0.0.1/32            ident
#host    replication     postgres        ::1/128                 ident

2 个答案:

答案 0 :(得分:0)

尝试更改

local   all             all                                     peer

到:

local   all             all                                     md5

答案 1 :(得分:0)

在Ubuntu Bionic上也有同样的问题,可以通过将localhost显式添加为主机来解决:

export PGPASSWORD=icinga
psql -U icinga -d icinga -h localhost < /usr/share/icinga2-ido-pgsql/schema/pgsql.sql
相关问题