Mariadb连接客户端:在mysql 8.0上拒绝用户访问(使用密码:NO) [英] Mariadb connection client: Access denied for user (using password: NO) on mysql 8.0

查看:141
本文介绍了Mariadb连接客户端:在mysql 8.0上拒绝用户访问(使用密码:NO)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

mariadb-java-client在mysql 8.0上抛出拒绝访问,但在mysql 5.6上有效所以我想知道mariadb客户端是否与mysql 8.0兼容

mariadb-java-client throws access denied on mysql 8.0, but works on mysql 5.6 So I wonder if mariadb client is compatible with mysql 8.0

  1. 在mysql中,将测试用户的限制设置为主机=%

  1. in mysql, test users are set limit to hosts machine = %

即使在mysql 8.0的计算机上进行了测试,同样的访问被拒绝错误.

even tested on mysql 8.0's machine, same access denied error.


Caused by: java.sql.SQLException: Access denied for user 'user1'@'192.168.238.1' (using password: NO)
Current charset is UTF-8. If password has been set using other charset, consider using option 'passwordCharacterEncoding'


    Connection connection = DriverManager.getConnection("jdbc:mariadb://192.168.0.2:3306/test", "user1", "admin@123");
    Statement stmt = connection.createStatement();
    stmt.executeUpdate("CREATE TABLE a (id int not null primary key, value varchar(20))");
    stmt.executeUpdate("DROP TABLE a");
    stmt.close();
    connection.close();

在mysql 5.6和8.0上具有相同的用户名和密码

Same user name and password on mysql 5.6 and 8.0

  1. 成功:'mariadb-java-client',版本:'2.3.0',mysql 5.6

  1. Succeeded: 'mariadb-java-client', version: '2.3.0', mysql 5.6

失败:"mariadb-java-client",版本:"2.3.0",mysql 8.0

Failed: 'mariadb-java-client', version: '2.3.0', mysql 8.0

成功:'mysql-connector-java',版本:'8.0.13'mysql 8.0(jdbc:mysql://....)

Succeeded: 'mysql-connector-java', version: '8.0.13' mysql 8.0 (jdbc:mysql://....)

推荐答案

从MySQL 5.7(和MariaDB)开始,MySQL 8使用caching_sha2_password而不是mysql_native_password.

MySQL 8 uses caching_sha2_password rather than mysql_native_password as of MySQL 5.7 (and MariaDB).

"caching_sha2_password,它是从MySQL 8.0开始的首选身份验证插件,也是默认的身份验证插件,而不是mysql_native_password.此更改会影响服务器和libmysqlclient客户端库:"

"caching_sha2_password, it is as of MySQL 8.0 the preferred authentication plugin, and is also the default authentication plugin rather than mysql_native_password. This change affects both the server and the libmysqlclient client library:"

https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password

MariaDB的Java连接器尚未实现,但已分配了一个任务:

MariaDB's Java Connector does not yet implement this, but has a task assigned:

https://jira.mariadb.org/browse/CONJ-663

要连接到MySQL 8,您将必须使用Oracle连接器(另一个支持该更改的连接器),或等待MariaDB实施.

In order to connect to MySQL 8, you will have to use the Oracle connector, another connector that supports the change, or wait for MariaDB to implement.

这篇关于Mariadb连接客户端:在mysql 8.0上拒绝用户访问(使用密码:NO)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆