GVKun编程网logo

如何解决无法加载身份验证插件“ caching_sha2_password”的问题(加载身份验证的答案是什么)

16

本文将带您了解关于如何解决无法加载身份验证插件“caching_sha2_password”的问题的新内容,同时我们还将为您解释加载身份验证的答案是什么的相关知识,另外,我们还将为您提供关于asp.n

本文将带您了解关于如何解决无法加载身份验证插件“ caching_sha2_password”的问题的新内容,同时我们还将为您解释加载身份验证的答案是什么的相关知识,另外,我们还将为您提供关于asp.net C# 连接MySQL8.0的caching_sha2_password问题、Authentication plugin ''caching_sha2_password'' cannot be loaded、authentication plugin caching_sha2_password cannot be loaded、caching_sha2_password‘ cannot be loaded问题解决的实用信息。

本文目录一览:

如何解决无法加载身份验证插件“ caching_sha2_password”的问题(加载身份验证的答案是什么)

如何解决无法加载身份验证插件“ caching_sha2_password”的问题(加载身份验证的答案是什么)

在Eclipse中,当我启动我的应用程序时,我得到了-无法找到要使用的方言。java.sql.SQLException:无法加载身份验证插件“ caching_sha2_password”。

at java.sql.SQLException: Unable to load authentication plugin ''caching_sha2_password''. at at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:868) at at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:864) at at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1746) at at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1226) at at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2191) at at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2222) at at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2017) at at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:779) at at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47) at at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at at java.lang.reflect.Constructor.newInstance(Unknown Source) at at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389) at at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330) at at java.sql.DriverManager.getConnection(Unknown Source) at at java.sql.DriverManager.getConnection(Unknown Source) at at ch.qos.logback.core.db.DriverManagerConnectionSource.getConnection(DriverManagerConnectionSource.java:54) at at ch.qos.logback.core.db.ConnectionSourceBase.discoverConnectionProperties(ConnectionSourceBase.java:46) at at ch.qos.logback.core.db.DriverManagerConnectionSource.start(DriverManagerConnectionSource.java:38) at at ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(NestedComplexPropertyIA.java:161) at at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:309) at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:193) at at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:179) at at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62) at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:165) at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:152) at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110) at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53) at at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75) at at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150) at at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84) at at org.slf4j.impl.StaticLoggerBinder.(StaticLoggerBinder.java:55) at at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150) at at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124) at at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:412) at at ch.qos.logback.classic.util.StatusViaSLF4JLoggerFactory.addStatus(StatusViaSLF4JLoggerFactory.java:32) at at ch.qos.logback.classic.util.StatusViaSLF4JLoggerFactory.addInfo(StatusViaSLF4JLoggerFactory.java:20) at at ch.qos.logback.classic.servlet.LogbackServletContainerInitializer.onStartup(LogbackServletContainerInitializer.java:32) at at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5245) at at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1421) at at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1411) at at java.util.concurrent.FutureTask.run(Unknown Source) at at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at at java.lang.Thread.run(Unknown Source)

答案1

小编典典

从MySQL 8.0.4开始,他们将MySQL服务器的默认身份验证插件从mysql_native_password更改为 caching_sha2_password。

你可以运行以下命令来解决此问题。

sample username / password => student / pass123

ALTER USER ''student''@''localhost'' IDENTIFIED WITH mysql_native_password BY ''pass123'';

有关详细信息,请参见官方页面:MySQL参考手册

asp.net C# 连接MySQL8.0的caching_sha2_password问题

asp.net C# 连接MySQL8.0的caching_sha2_password问题

解决方法可用以下命令:

命令行登录mysql;
mysql>use mysql;
mysql>ALTER USER root IDENTIFIED WITH mysql_native_password BY ''你的密码'';
mysql>FLUSH PRIVILEGES;

网上说用:

MySql 8.0 C#连接报错 MySql.Data.MySqlClient.MySqlException (0x80004005): Authentication to host ''xxx'' for user ''root'' using method ''caching_sha2_password'' failed with message: Reading from t
解决方法
在连接字符串后面加上   SslMode=None

以上方法未成功,可能还是mysql 8.0密码验证机制问题导致,所以需要修改一下my.ini文件如下:

如果安装目录下找不到my.ini文件 windows系统下处理如下,打开C盘 查看选项中,查看隐藏文件,如果不出意外在programeData下(C:\ProgramData\MySQL\MySQL Server 8.0)找到my.ini

加入这一项 default_authentication_plugin=mysql_native_password

然后在服务中重启MySQL80服务

[mysqld]
default_authentication_plugin=mysql_native_password

Linux 下可以修改在/etc/my.cnf文件

 

Authentication plugin ''caching_sha2_password'' cannot be loaded

Authentication plugin ''caching_sha2_password'' cannot be loaded

很多用户在使用mysql客户端工具连接MySQL数据库时会出现Authentication plugin ''caching_sha2_password'' cannot be loaded的错误。(我使用的是sqlyog)

出现这个原因是mysql8 之前的版本中加密规则是mysql_native_password,而在mysql8之后,加密规则是caching_sha2_password, 解决问题方法有两种,一种是升级navicat驱动,一种是把mysql用户登录密码加密规则还原成mysql_native_password. 

这里用第二种方式 ,解决方法如下

1. 管理员权限运行命令提示符,登陆MySQL(记得添加环境变量)
不添加环境变量的话请切换到mysql安装目录我的mysql安装在 C:Program FilesMySQLMySQL Server 8.0
执行
   mysql -u root -p

   password:123456
密码输入自己设置的mysql密码
#登入mysql 截图如下:
image.png

2. 修改账户密码加密规则并更新用户密码

   ALTER USER ''root''@''localhost'' IDENTIFIED BY ''password'' PASSWORD EXPIRE NEVER;   #修改加密规则 
image.png

   ALTER USER ''root''@''localhost'' IDENTIFIED WITH mysql_native_password BY ''password'';   #更新一下用户的密码 
image.png
3. 刷新权限并重置密码

   FLUSH PRIVILEGES;   #刷新权限 
image.png

再次打开mysql客户端工具进行连接,#success!!!
image.png

参考链接:https://www.cnblogs.com/zhurong/p/9898675.html

authentication plugin caching_sha2_password cannot be loaded

authentication plugin caching_sha2_password cannot be loaded

最近下载新的 MySQL8.0 来使用的时候, 通过 sqlyog、或者程序中连接数据库时,提示:Authentication plugin ''caching_sha2_password'' cannot be loaded 的错误,经查看发现,8.0 改变了 身份验证插件 , 打开 my.ini (或者 my.cofg) 可以看到变更了 5.7 及其以前的方式: mysql_native_password

解决 
Authentication plugin ‘caching_sha2_password’ cannot be loaded 的方法,可以往你的连接工具、或者程序应用显示指定身份验证方式,或者直接改为以前的版本方式: 
你可以使用如下方式:

这里 root 的密码改为 hovertree,使用老版本的身份验证插件方式: 
ALTER USER root@localhost IDENTIFIED WITH mysql_native_password BY ‘hovertree’;

 

  先来解释一下为什么会报这个错,在 mysql8 之前的版本使用的密码加密规则是 mysql_native_password,但是在 mysql8 则是 caching_sha2_password。

  解决方案有很多,我是创建了一个新用户,并指定加密规则为:mysql_native_password,这样的话,仅需要执行以下语句即可:

create user ''your username''@''%'' identified with mysql_native_password by ''your password''

  也可以直接修改 my 配置文件,将默认密码规则设置为 mysql_native_password,刷新权限并重置 root 密码即可。

default_authentication_plugin=mysql_native_password

  如果想用新的 caching_sha2_password 也是可以的,java 的话 mysql 已经推出了新的 mysql-connector-java 包,引入后,驱动使用 com.mysql.cj.jdbc.driver 即可,这个方案本地试了。没有问题。

 

在安装 mysql8 的时候如果选择了密码加密,之后用客户端连接比如 navicate,会提示客户端连接 caching-sha2-password, 是由于客户端不支持这种插件,可以通过如下方式进行修改:

     #修改加密规则  
    ALTER USER ''root''@''localhost'' IDENTIFIED BY ''password'' PASSWORD EXPIRE NEVER; #更新密码(mysql_native_password模式) ALTER USER ''root''@''localhost'' IDENTIFIED WITH mysql_native_password BY ''Hovertree'';

其中 Hovertree 为新密码

caching_sha2_password‘ cannot be loaded问题解决

caching_sha2_password‘ cannot be loaded问题解决

在mac上安装 8.0.19版本的MysqL后,使用navicat连接时,报caching_sha2_password' cannot be loaded的异常。

原因为:8.0.19版本的mysq用户密码加密方式为caching_sha2_password,navicat暂不支持,需要修改下MysqL的加密方式。

解决过程:

1.登陆MysqL

MysqL -u root -p
2.查看当前加密方式

use MysqL;
select user,plugin from user where user='root';
可以看到,root账号密码加密方式为caching_sha2_password。

3.修改加密方式

alter user 'root'@'localhost' identified with MysqL_native_password by 'password';
4.刷新权限表,使设置生效

flush privileges;

————————————————
版权声明:本文为CSDN博主「爱思考的实践者」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/chinawangfei/article/details/110948493

今天关于如何解决无法加载身份验证插件“ caching_sha2_password”的问题加载身份验证的答案是什么的分享就到这里,希望大家有所收获,若想了解更多关于asp.net C# 连接MySQL8.0的caching_sha2_password问题、Authentication plugin ''caching_sha2_password'' cannot be loaded、authentication plugin caching_sha2_password cannot be loaded、caching_sha2_password‘ cannot be loaded问题解决等相关知识,可以在本站进行查询。

本文标签: