温馨提示:本文翻译自stackoverflow.com,查看原文请点击:jdbc - Cannot connect to local postgresql DB using DBeaver
dbeaver jdbc postgresql

jdbc - 无法使用DBeaver连接到本地Postgresql DB

发布于 2020-05-03 18:56:50

我正在尝试连接到localhost:5432中的postgresql数据库,但我不断收到错误消息:致命:用户“”的身份验证失败。

我在运行Centos7的虚拟机上安装了Postgres11。通过命令行创建了一个名为business_db的数据库。

我已经检查过并且postgresql在localhost:5432中运行。

我的pg_hba.conf文件是这样的:

# TYPE  DATABASE        USER            ADDRESS                 METHOD
local   all             all                                     peer
host    all             all             127.0.0.1/32           ident
host    all             all             ::1/128                 ident
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            ident
host    replication     all             ::1/128                 ident

pg_ident.conf文件不包含任何配置:

# Put your actual configuration here
# ----------------------------------

# MAPNAME       SYSTEM-USERNAME         PG-USERNAME

该数据库存在,如命令所示:

数据库清单

我以“ dev”用户身份登录系统,但是,无论我在测试连接数据库DBeaver时尝试执行什么,我总是得到错误消息:

错误

我还尝试将User设置为postgres并使用我的系统密码,但得到相同的错误。我想念什么?

查看更多

提问者
ayaros
被浏览
161
a_horse_with_no_name 2020-02-14 23:19

使用JDBC时,必须使用密码验证。既不行,ident也不行peer

您将需要添加,例如:

host    all             all             127.0.0.1/32           md5

在您的pb_hba.conf顶部

如果正在使用,请替换md5scram-sha-256