我间歇性地面临以下错误。通过在 mysql 服务器设置中使用“跳过名称解析”选项可以解决此问题。
但是,根据网上发现的许多建议,使用 127.0.0.1 应该可以解决该问题。但这也没有帮助,您能否建议我一个解决方法或一个 SQL 命令,通过它我可以检查“跳过名称解析”选项。
Error 1: 0
Authentication to host '127.0.0.1' for user 'root' using method 'mysql_native_password' failed with message: Reading from the stream has failed.
Stack Trace:
at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.AuthenticationFailed(Exception ex)
at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.ReadPacket()
at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.Authenticate(Boolean reset)
at MySql.Data.MySqlClient.NativeDriver.Authenticate(String authMethod, Boolean reset)
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.Driver.Open()
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
这是更新到 MySQL Server 8.+ 时发生的常见错误。
默认情况下,MySQL 8 使用 caching_sha2_password,它是 mysql_native_password 的升级身份验证插件。
解决此问题的方法是将用户密码的插件专门设置为 caching_sha2_password
CREATE USER 'sha2user'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'password'
更新 MySQL 服务器以接受 mysql_native_password。
[mysqld]
default_authentication_plugin=mysql_native_password
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)