Shy*_*ikh 7 c# mysql sql visual-studio-2010
我间歇性地面临以下错误.它通过在mysql服务器设置中使用'skip name resolve'选项来解决.
但是,根据网上发现的许多建议,使用127.0.0.1应该已经解决了这个问题.但是这也没有帮助你可以建议我一个变通方法或SQL命令,通过它我可以检查'skip name resolve'选项.
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()
Run Code Online (Sandbox Code Playgroud)
小智 1
这是更新到 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'
Run Code Online (Sandbox Code Playgroud)
更新 MySQL 服务器以接受 mysql_native_passwords。
[mysqld]
default_authentication_plugin=mysql_native_password
Run Code Online (Sandbox Code Playgroud)