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

2022-01-15 00:00:00 mariadb mysql dbeaver

我正在尝试在端口 3306 上连接到 MariaDb 的本地主机实例.我很清楚,由于 MariaDb 规范,root 不能使用 localhost,所以我创建了来自命令行的另一个用户,密码为root"并授予我的测试"数据库的所有权限:

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;

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

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

用户'myuser'@'localhost'的访问被拒绝(使用密码:YES)当前字符集是 windows-1251.如果已使用其他方式设置密码charset,考虑使用选项'passwordCharacterEncoding'

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'

为什么会这样?是因为 DBeaver 和 MariaDB 的实例之间的某些密码哈希算法不匹配吗?如何解决此问题并成功连接?

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?

推荐答案

你必须去 DriverProperties 并输入你用来编码密码的编码(UTF-8).当您使用 docker image 在本地运行 maria db 时,这很常见参考下图.

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.

相关文章