首页

解决mysql连接启动“SQLException: Client does not support authentication protocol requested by server; consider upgrading MySQL client”错误异常

标签:mysql     发布时间:2023-11-19   

一、异常描述

连接mysql数据库报“ java.sql.SQLException: Client does not support authentication protocol requested by server; consider upgrading MySQL client”错误异常。

java.sql.SQLException: Client does not support authentication protocol requested@b@ by server; consider upgrading MySQL client@b@        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2901)@b@        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:773)@b@        at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3612)@b@        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1204)@b@        at com.mysql.jdbc.Connection.createNewIO(Connection.java:1699)@b@        at com.mysql.jdbc.Connection.<init>(Connection.java:408)@b@        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java@b@:270)@b@        at java.sql.DriverManager.getConnection(DriverManager.java:664)@b@        at java.sql.DriverManager.getConnection(DriverManager.java:247)@b@        at com.xwood.engine.common.util.MySQLDBUtil.getConnection(MySQLDBUtil.ja@b@va:36)@b@        at com.xwood.engine.common.util.MySQLDBUtilExt.<clinit>(MySQLDBUtilExt.j@b@ava:19)@b@        at com.xwood.engine.index.solrj.SQLUnitDao.getProcesserS0Data(SQLUnitDao@b@.java:35)@b@        at com.xwood.engine.index.solrj.SolrCoreProcesser.load(SolrCoreProcesser@b@.java:44)@b@        at com.xwood.engine.index.solrj.SolrCoreProcesser.processStep(SolrCorePr@b@ocesser.java:35)@b@        at com.xwood.engine.BaseCommonProcesser$1.run(BaseCommonProcesser.java:3@b@4)@b@        at java.util.TimerThread.mainLoop(Timer.java:555)@b@        at java.util.TimerThread.run(Timer.java:505)@b@Exception in thread "Timer-0" java.lang.ExceptionInInitializerError@b@        at com.xwood.engine.index.solrj.SQLUnitDao.getProcesserS0Data(SQLUnitDao@b@.java:35)@b@        at com.xwood.engine.index.solrj.SolrCoreProcesser.load(SolrCoreProcesser@b@.java:44)@b@        at com.xwood.engine.index.solrj.SolrCoreProcesser.processStep(SolrCorePr@b@ocesser.java:35)@b@        at com.xwood.engine.BaseCommonProcesser$1.run(BaseCommonProcesser.java:3@b@4)@b@        at java.util.TimerThread.mainLoop(Timer.java:555)@b@        at java.util.TimerThread.run(Timer.java:505)@b@Caused by: java.lang.RuntimeException: Client does not support authentication pr@b@otocol requested by server; consider upgrading MySQL client@b@        at com.xwood.engine.common.util.MySQLDBUtil.getConnection(MySQLDBUtil.ja@b@va:40)@b@        at com.xwood.engine.common.util.MySQLDBUtilExt.<clinit>(MySQLDBUtilExt.j@b@ava:19)@b@        ... 6 more

                                                                                                                                                                                                                                                                       

二、解决方法

1)修改mysql的数据库连接串 - 原来连接串如下

mysql.jdbc.1.driver=com.mysql.jdbc.Driver

改为

mysql.jdbc.1.driver=com.mysql.cj.jdbc.Driver

2)更新驱动jar,将mysql-connector-java-3.2.0-alpha-bin.jar 改为mysql-connector-java-8.0.13.jar

3)重启即可解决问题

@b@
<<热门下载>>