如何解决无法加载验证插件“缓存\u sha2\u密码”问题

sqyvllje  于 2021-06-17  发布在  Mysql
关注(0)|答案(16)|浏览(490)

在eclipse中,当我启动我的应用程序时,我得到了这样一个问题:无法发现要使用的方言。java.sql.sqlexception:无法加载身份验证插件“caching\u sha2\u password”。
在java.sql.sqlexception:无法加载身份验证插件“caching\u sha2\u password”。在com.mysql.jdbc.sqlerror.createsqlexception(sqlerror。java:868)在com.mysql.jdbc.sqlerror.createsqlexception(sqlerror。java:864)在com.mysql.jdbc.mysqlio.proceedhandshakewithpluggableauthentication(mysqlio。java:1746)在com.mysql.jdbc.mysqlio.dohandshake(mysqlio。java:1226)在com.mysql.jdbc.connectionimpl.coreconnect(connectionimpl。java:2191)在com.mysql.jdbc.connectionimpl.connectonetryonly(connectionimpl。java:2222)在com.mysql.jdbc.connectionimpl.createnewio(connectionimpl。java:2017)在com.mysql.jdbc.connectionimpl。java:779)在com.mysql.jdbc.jdbc4connection.(jdbc4connection。java:47)在位于sun.reflect.nativeconstructoraccessorimpl.newinstance0(本机方法),位于sun.reflect.nativeconstructoraccessorimpl.newinstance(未知源),位于sun.reflect.delegatingconstructoraccessorimpl.newinstance(未知源),位于java.lang.reflect.constructor.newinstance(未知源),位于com.mysql.jdbc.util.handlenewinstance(util。java:425)在com.mysql.jdbc.connectionimpl.getinstance(connectionimpl。java:389)在com.mysql.jdbc.nonregisteringdriver.connect(nonregisteringdriver。java:330)位于java.sql.drivermanager.getconnection(未知源),位于java.sql.drivermanager.getconnection(未知源)ch.qos.logback.core.db.driverManager连接源.getconnection(driverManager连接源)。java:54)在ch.qos.logback.core.db.connectionsourcebase.discoverconnectionproperties(connectionsourcebase。java:46)位于ch.qos.logback.core.db.drivermanagerconnectionsource.start(drivermanagerconnectionsource)。java:38)在ch.qos.logback.core.joran.action.nestedcomplexpropertyia.end(nestedcomplexpropertyia。java:161)at ch.qos.logback.core.joran.spi.interpreter.callendaction(解释器。java:309)at ch.qos.logback.core.joran.spi.interpreter.endelement(解释器。java:193)at ch.qos.logback.core.joran.spi.interpreter.endelement(解释器。java:179)在ch.qos.logback.core.joran.spi.eventplayer.play(eventplayer。java:62)在ch.qos.logback.core.joran.genericconfigurator.doconfigure(genericconfigurator。java:165)在ch.qos.logback.core.joran.genericconfigurator.doconfigure(genericconfigurator。java:152)在ch.qos.logback.core.joran.genericconfigurator.doconfigure(genericconfigurator。java:110) 在ch.qos.logback.core.joran.genericconfigurator.doconfigure(genericconfigurator。java:53)在ch.qos.logback.classic.util.contextinitializer.configurebyresource(contextinitializer。java:75)在ch.qos.logback.classic.util.contextinitializer.autoconfig(contextinitializer。java:150)在org.slf4j.impl.staticloggerbinder.init(staticloggerbinder。java:84)在org.slf4j.impl.staticloggerbinder。java:55)在org.slf4j.loggerfactory.bind(loggerfactory。java:150)在org.slf4j.loggerfactory.performinization(loggerfactory。java:124)在org.slf4j.loggerfactory.getiloggerfactory(loggerfactory。java:412)在ch.qos.logback.classic.util.statusviaslf4jloggerfactory.addstatus(statusviaslf4jloggerfactory。java:32)在ch.qos.logback.classic.util.statusviaslf4jloggerfactory.addinfo(statusviaslf4jloggerfactory。java:20)在ch.qos.logback.classic.servlet.logbackservletcontainerinitializer.onstartup(logbackservletcontainerinitializer。java:32)在org.apache.catalina.core.standardcontext.startinternal(standardcontext。java:5245)在org.apache.catalina.util.lifecyclebase.start(lifecyclebase。java:150)在org.apache.catalina.core.containerbase$startchild.call(containerbase。java:1421)在org.apache.catalina.core.containerbase$startchild.call(containerbase。java:1411)在java.util.concurrent.futuretask.run(未知源)at java.util.concurrent.threadpoolexecutor.runworker(未知源)at java.util.concurrent.threadpoolexecutor$worker.run(未知源)at java.lang.thread.run(未知源)

tjvv9vkg

tjvv9vkg16#

如上所述:
从mysql 8.0.4开始,mysql团队将mysql服务器的默认身份验证插件从mysql\u native\u password更改为caching\u sha2\u password。
所以有三种方法可以解决这个问题:

1. drop USER 'user_name'@'localhost';
    flush privileges;
    CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'user_name';
    GRANT ALL PRIVILEGES ON * . * TO 'user_name'@'localhost';
    ALTER USER 'user_name'@'localhost' IDENTIFIED WITH mysql_native_password BY 
    'user_name';

 2. drop USER 'user_name'@'localhost';
    flush privileges;
    CREATE USER 'user_name'@'localhost' IDENTIFIED WITH mysql_native_password BY 'user_name';
GRANT ALL PRIVILEGES ON * . * TO 'user_name'@'localhost'

 3. If the user is already created, the use the following command:

    ALTER USER 'user_name'@'localhost' IDENTIFIED WITH mysql_native_password BY 
        'user_name';

相关问题