Authentication method 'caching_sha2_password' not supported by any of the available plugins.

这是MySQL8.0一个登录验证的问题。

第一步 初始化配置

如果已经初始化了,就直接跳过第一步

你需要知道的是:MySQL安装的路径。我的路径是:G:\mysql-8.0.11-winx64

在C:\Windows\System32路径下找到cmd.exe,右键以管理员身份运行,并切换到mysql-8.0.11-winx64中。

输入命令初始化data目录:

mysqld --initialize --console 会出现一段内容,找到内容中root@localhost: 它后面就是登录数据库的初始密码,一定要记下来

再输入命令初始化mysql服务

mysqld --install 然后输入命令启动mysql

net start mysql 如果已经启动了,他会提示你服务已经启动。

如果提示拒绝访问,那你肯定没有以管理员身份运行cmd。在C:\Windows\System32路径下找到cmd.exe,右键以管理员身份运行。继续上步操作。

接下来,登录到数据库

mysql -u root -p 密码:输入就是刚才记下来的,

登陆成功后接着更改密码,输入

ALTER USER ‘root‘@‘localhost‘ IDENTIFIED WITH mysql_native_password BY ‘新密码‘;
这以上只是确保不会出现其他的问题,还不能解决密码验证的问题。

第二步 修改MySQL的登录验证配置

cmd连接mysql

mysql -u root -p 修改加密规则

ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘password‘ PASSWORD EXPIRE NEVER; 更新一下用户的密码

ALTER USER ‘root‘@‘localhost‘ IDENTIFIED WITH mysql_native_password BY ‘password‘; 刷新权限

FLUSH PRIVILEGES; 重置下密码(123456789这里是你要设置的密码)

ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘123456789‘; 完成以后,试着重新连接mysql数据库,如果还没有成功,继续往下走:

第三步 根目录增加配置文件

在mysql-8.0.11-winx64这个目录下,新建my.ini文件,文件内容如下,记得保存:

[mysqld]

默认使用“mysql_native_password”插件认证

default_authentication_plugin=mysql_native_password [mysql]

设置mysql客户端默认字符集

default-character-set=utf8 [client]

设置mysql客户端连接服务端时默认使用的端口

port=3306 default-character-set=utf8

默认使用“mysql_native_password”插件认证

default_authentication_plugin=mysql_native_password [mysql]

设置mysql客户端默认字符集

default-character-set=utf8 [client]

设置mysql客户端连接服务端时默认使用的端口

port=3306 default-character-set=utf8 接下来需要重启mysql服务。

先停止mysql服务,

net stop mysql 如果提示拒绝访问,那你肯定没有以管理员身份运行cmd。在C:\Windows\System32路径下找到cmd.exe,右键以管理员身份运行。继续上步操作。

已停止成功后,继续输入命令启动mysql

net start mysql 查看是不是可以正常启动

如果无法启动,就是那个my.ini文件的问题,尝试只保留文件中的一部分

[mysqld]

默认使用“mysql_native_password”插件认证

default_authentication_plugin=mysql_native_password 继续启动mysql。

启动成功后,就说明修改配置文件成功,尝试去连接数据库,应该就成功了

Authentication method 'caching_sha2_password' not supported by any of the available plugins.

原文地址:https://www.cnblogs.com/Anthony518/p/11570348.html

时间: 2024-08-01 02:49:17

Authentication method 'caching_sha2_password' not supported by any of the available plugins.的相关文章

Authentication method 'caching_sha2_password' not supported by any of the av的解决方法

Authentication method 'caching_sha2_password' not supported by any of the av的意思是任何av都不支持身份验证方法“缓存密码” 通常的报这个错误是因为它的身份验证方式是  mysql_native_password 方式,不是caching_sha2_password方式 方法一 如果是通过解压去安装的MySQL 8.0版本 1.找一下看有没有my.ini文件 没有就在你解压密闭的目录下新创建一个my.ini文件 my.i

The server requested authentication method unknown to the client

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client. In MySQL 8.0+, the default authentication plugin has changed from 'mysql_native_password' to 'caching_sha2_password', and the 'root'@'localhost' administrative a

PHP错误:SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

使用PHP连接MySQL 8的时候,可能会发生如标题所示的错误: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client 发生这种错误,是由于MySQL 8默认使用了新的密码验证插件:caching_sha2_password,而之前的PHP版本中所带的mysqlnd无法支持这种验证.解决这个问题,有两种办法. 一种办法是升级PHP支持MySQL 8的新验证插件. PHP 7.

mysql错误:this authentication plugin is not supported

this authentication plugin is not supported 应用程序连接mysql docker一直报错:this authentication plugin is not supported. google发现,原来是mysql新版本(8.0以上)将root用户使用的plugin更新成caching_sha2_password. 登录mysql输入如下命令可以看到: mysql> select user,plugin from mysql.user;+-------

Asp.Net Core 3.1 获取不到Post、Put请求的内容 System.NotSupportedException Specified method is not supported

问题 是这样的,我.net core 2.1的项目,读取.获取Post请求内容的一段代码,大概这样: [HttpPost] public async Task<IActionResult> Test([FromBody]string postStr) { using (var reader = new StreamReader(Request.Body, System.Text.Encoding.UTF8)) { reader.BaseStream.Seek(0, SeekOrigin.Beg

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

安装 nextcloud 的时候选择的是 mysql ,在链接 mysql 的时候报错,信息如下: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client 搜索了下应该是 MySQL 8默认使用了新的密码验证插件:caching_sha2_password ,而有些 PHP 版本不支持这个问题造成的 解决办法: 修改登录用户的 plugin 为 mysql_native_pas

springmvc表单提交出现WARNING: Request method &#39;GET&#39; not supported

明明表单提交的method设置为post,然后在controller那设置只能请求为post请求 然后第一次post请求是正常的,第二次开始后便不正常了,出现post的请求302,get请求405:这个结果很纳闷吧 <!--注意action的路径--> <form id="form1" action="upload" method="post" enctype="multipart/form-data">

Network authentication method and device for implementing the same

A network authentication method is to be implemented using a network authentication device and a user end for authenticating the user end. The network authentication method includes the steps of: configuring the network authentication device to store

SpringMVC框架出现 405 request method post not supported 的解决方法

在SpringMVC框架中当使用post请求服务,然后请求成功转到一个静态文件,如html,htm等网页时.页面出现405 request method post not supported错误,只要在spring的配置文件中加入下面代码即可: <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="urlMap"&