MySQL从流读取失败 [英] MySQL Reading from stream failed
问题描述
我间歇性地遇到以下错误.通过在mysql服务器设置中使用跳过名称解析"选项可以解决该问题.
I am facing the following error intermittently. It is solved by using 'skip name resolve' option in the mysql server settings.
但是,根据网上发现的许多建议,使用127.0.0.1应该可以解决此问题.但这也无济于事,您能否建议我一种解决方法或一条SQL命令,通过它我可以检查跳过名称解析"选项.
However, as per many suggestions found on net, using 127.0.0.1 should have solved the issue. But this too didn't help can you suggest me a workaround or a SQL command through which I can check the 'skip name resolve' option.
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之上的升级身份验证插件.
This is a common error that happens when you update to MySQL Server 8.+. By default MySQL 8 uses caching_sha2_password which is an upgraded authentication plugin over the mysql_native_password.
解决此问题的一种方法是将用户密码的插件专门设置为caching_sha2_password
A way to fix this is by either specifically setting the plugin for the user's password to caching_sha2_password
CREATE USER 'sha2user'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'password'
更新MySQL服务器以接受mysql_native_passwords.
Updating the MySQL Server to accept mysql_native_passwords.
[mysqld]
default_authentication_plugin=mysql_native_password
这篇关于MySQL从流读取失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!