![]() | 1 AllenHua 2021-07-09 13:23:21 +08:00 顶一下帖。我昨天也是装了 8.0,然后用我常用的 navicat 连接,无法连接 MySQL Error: Client does not support authentication protocol requested by server 从 csdn 到 stackoverflow 和各种英文网页,尝试了都没能解决。我知道是 mysql8.0 更改了认证方式,但是按照网上的说法,没一个靠谱的…… |
![]() | 2 AllenHua 2021-07-09 13:23:59 +08:00 用 datagrip 就正常连接,后面装了 5.7,使用 navicat 连接就正常了…… |
![]() | 4 c978R77Le1z2f8u9 2021-07-09 13:27:18 +08:00 8.0 的验证方法变了,IDENTIFIED WITH mysql_native_password 就行 |
![]() | 5 shiny 2021-07-09 13:27:28 +08:00 偷懒方法就是初始化数据库的时候使用原来的验证方式 [mysqld] default_authentication_plugin=mysql_native_password |
![]() | 7 AlkTTT 2021-07-09 13:39:07 +08:00 driver-class-name: com.mysql.cj.jdbc.Driver,这个换了吗 |
![]() | 8 AllenHua 2021-07-09 13:51:39 +08:00 @AlkTTT #6 navicat 11.0.9 企业版 mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘New root password’; MySQL 8 默认使用了新的密码验证插件:caching_sha2_password 比如这篇文章: https://zhuanlan.zhihu.com/p/36087723 是 navicat 版本过低的原因? mysql 改了,也重启了,使用 navicat 11.0.9 企业版 登录还是无法登录,报错如下 > 1251 Client does not support authentication protocol requested by server; consider upgrading MySQL client |
![]() | 9 AllenHua 2021-07-09 13:53:43 +08:00 @AlkTTT #7 没有换,我等会试试。谢谢 MySQL 8.0 以上版本的数据库连接有所不同:com.mysql.jdbc.Driver 更换为 com.mysql.cj.jdbc.Driver 。https://www.runoob.com/java/java-mysql-connect.html |
![]() | 10 AllenHua 2021-07-09 14:02:26 +08:00 |
![]() | 12 xsm1890 2021-07-09 14:26:30 +08:00 java.sql.SQLException: Unknown system variable 'tx_isolation'。 这么大个报错。。 |
![]() | 13 AllenHua 2021-07-09 14:27:28 +08:00 @AlexPUBLIC #4 @shiny #5 @AlkTTT #6 我换了 navicat 15,使用 mysql_native_password 验证的方式,连接 mysql 8 成功了。还就是 navicat 版本的问题。 @mohulai 对楼主说声抱歉,占用了你的帖子的资源。 楼主也看看驱动问题 MySQL 8.0 以上版本的数据库连接有所不同:com.mysql.jdbc.Driver 更换为 com.mysql.cj.jdbc.Driver 。https://www.runoob. com/java/java-mysql-connect.html |
![]() | 14 xsm1890 2021-07-09 14:27:51 +08:00 @@tx_isolation is deprecated and will be removed in a future release.pleas use @@transaction_isolation instead |
15 cslive 2021-07-09 14:30:48 +08:00 ?serverTimezOne=UTC&useSSL=false&autoRecOnnect=true&tinyInt1isBit=false&useUnicode=true&characterEncoding=utf8 加上试试,自己就是这么用得 |
![]() | 16 mohulai OP @xsm1890 #14 Java 连接里面没有这些内容啊,是要在 mysql 的命令行里改吗?刚用 mysql,不太熟。 |
![]() | 17 xsm1890 2021-07-09 15:04:18 +08:00 @mohulai 不是啊,这个是数据库事务隔离级别的参数。版本间写法不一样了而已 ,这是报错的根本原因。参数写在驱动里面,升级驱动版本就能解决 |
![]() | 18 mohulai OP @shiny #5 我看了我的 Mysql my.ini 文件 default_authentication_plugin=mysql_native_password 这条一直都在 |
![]() | 19 mohulai OP @AlexPUBLIC #4 老哥这是加在哪里的? my.ini 里默认就是 mysql_native_password 。是因为 Java 的框架改了认证方式? |
![]() | 21 HDMItoDP 2021-07-09 15:17:30 +08:00 用 navicat15 试试,这个我一直用来连接 8.0,没问题的 |
22 hk1937 2021-07-09 18:46:44 +08:00 楼主能加个微请教下技术问题吗 ?小白~ |
![]() | 23 c978R77Le1z2f8u9 2021-07-10 05:06:05 +08:00 @mohulai 我是用的 python,sql8 命令行里改认证:ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; |