postgresql - 无法使用 DBeaver 连接到本地 postgresql 数据库

标签 postgresql jdbc dbeaver

我正在尝试连接到 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

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

Database list

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

ERROR

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

最佳答案

使用JDBC时,必须使用密码认证。都没有 ident也不是 peer将为此工作。

您需要添加,例如:

host    all             all             127.0.0.1/32           md5

在 pb_hba.conf 的顶部

(如果您正在使用它,请将 md5 替换为 scram-sha-256)

关于postgresql - 无法使用 DBeaver 连接到本地 postgresql 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60228723/

相关文章:

ms-access - 无法使用 DBeaver 和默认 UCanAccess-5.0.0 驱动程序连接到 MS Access mdb 文件

dbeaver - 如何导出DBeaver连接配置?

php - 如何为 laravel 设置默认的 postgresql 架构?

sql - 为什么 postgresql 不使用我的 group by 聚合索引?

sql - 为什么 MAX() 没有显示最高数字?

sql-server - Jmeter - 找不到适合 jdbc :microsoft:sqlserver://x. x.x.x:1433 的驱动程序

user-experience - 可以改进 dbeaver UX/减少所需的点击次数吗?

ruby-on-rails - 单个 Postgres 数据库中可以存在 20,000 个模式吗?

java - JDBC DriverManager 驱动程序选择

oracle - 勺子 : import data from Oracle