MariaDB – 无法使用正确密码从 Dbeaver 连接到 MariaDB 实例

huangapple go评论69阅读模式
英文:

MariaDB - Cannot connect to MariaDB instance from Dbeaver using correct password

问题

我正在尝试连接到端口3306上的MariaDb本地实例。
我非常清楚,由于MariaDb的规定,root用户不能使用localhost,所以我从命令行创建了另一个用户,密码为'root',并授予了我的'test'数据库所有特权:

CREATE USER 'myuser' IDENTIFIED BY 'root';
GRANT USAGE ON . TO 'myuser'@localhost IDENTIFIED BY 'root';
GRANT ALL privileges ON test.* TO 'myuser'@localhost;
FLUSH PRIVILEGES;

当我尝试使用正确的密码和用户名从DBeaver打开连接时,出现了错误:

用户'myuser'@'localhost'被拒绝访问(使用密码:是)
当前字符集为windows-1251。如果使用其他字符集设置了密码,请考虑使用选项'passwordCharacterEncoding'

为什么会发生这种情况?是因为DBeaver和MariaDB实例之间存在密码哈希算法不匹配吗?我该如何修复这个问题并成功连接?

英文:

I am trying to connect to a localhost instance of MariaDb on port 3306.
I'm well aware that root cannot use localhost because of MariaDb specifications so I created
another user from the command line with password 'root' and all privileges granted to my 'test' database:

CREATE USER 'myuser' IDENTIFIED BY 'root';
GRANT USAGE ON *.* TO 'myuser'@localhost IDENTIFIED BY 'root';
GRANT ALL privileges ON `test`.* TO 'myuser'@localhost;
FLUSH PRIVILEGES;

When I try to open a connection from DBeaver with the correct password and username, an error appears:

> Access denied for user 'myuser'@'localhost' (using password: YES)
> Current charset is windows-1251. If password has been set using other
> charset, consider using option 'passwordCharacterEncoding'

Why does it happen? Is it because of some password hashing algorithms mismatch between DBeaver and MariaDB's instance? How do I fix this and connect successfuly?

答案1

得分: 2

你需要前往DriverProperties,并输入你用来编码密码的编码方式(UTF-8)。当你在本地使用Docker镜像运行MariaDB时,这是非常常见的。请参考下面的图片链接:

MariaDB – 无法使用正确密码从 Dbeaver 连接到 MariaDB 实例

英文:

You have to to go to DriverProperties and enter the encoding you have used to encode password(UTF-8). This is very common when you use docker image to run maria db on your local Refer the below image.
MariaDB – 无法使用正确密码从 Dbeaver 连接到 MariaDB 实例

答案2

得分: 2

如果您想要修复此警告以适用于所有连接(而不仅仅是单个连接),您需要配置驱动程序的通用属性。

  1. 在 DBeaver 中,转到数据库 -> 驱动程序管理器

  2. 编辑 MariaDB/MySQL 驱动程序
    MariaDB – 无法使用正确密码从 Dbeaver 连接到 MariaDB 实例

  3. 选项卡 驱动程序属性,添加新的用户属性
    passwordCharacterEncodingUTF-8
    MariaDB – 无法使用正确密码从 Dbeaver 连接到 MariaDB 实例

  4. 完成,它将适用于所有使用已编辑驱动程序的连接

来源:MariaDB 驱动程序的参数

英文:

If you wanna fix this warning to all connections (not just single one) you need to configure driver's general properties.

  1. In dbeaver go to Database -> Driver Manager

  2. Edit MariaDB/MySQL driver
    MariaDB – 无法使用正确密码从 Dbeaver 连接到 MariaDB 实例

  3. Tab Driver properties, Add new User property
    passwordCharacterEncoding : UTF-8
    MariaDB – 无法使用正确密码从 Dbeaver 连接到 MariaDB 实例

  4. Voila, it works for all connections use edited driver

Source: mariaDB driver's parameters

答案3

得分: 0

我最近也遇到了同样的问题,在网上没有找到答案。我知道现在有点晚了,但对于仍然遇到这个问题的人,似乎是Dbeaver的一个bug,或许是一个...

每次我复制粘贴数据库和用户名时,都会出现这个确切的错误!当我直接在字段中输入时,我可以成功连接。

在生气之前,我建议尝试这个。

英文:

I had the same issue these days and didn’t find an answer online. I know it’s late, but for anyone who’s still suffering from this same problem, it’s seem to be a bug with Dbeaver or could be one...

Everytime I copy and paste the database and the username I get this exactly error! When I type it directly in the field I can connect successfully.

I would try this before getting mad

答案4

得分: -1

我认为这是一个编码问题。

在创建新连接之前,您应该在这里检查首选项:编码首选项

我将其更改为UTF-8后,它对我有效。

英文:

I think it's an encoding issue.

Before you create a new connection you should check the preferences here: encoding preferences

It worked for me as I changed it to UTF-8.

huangapple
  • 本文由 发表于 2020年1月3日 18:56:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/59577312.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定