加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

Mysql报错:Authentication .....Reading from the stream has failed

(2018-01-05 11:34:50)
分类: 编程
最近写个程序需要用到用C#连接Mysql5.7版本的数据库,结果总是报错:Authentication to host '171.13.164.***' for user 'root' using method 'mysql_native_password' failed with message: Reading from the stream has failed.不是每次都报,偶尔报错。最终在Mysql官网的bug提交区发现已经有人也遇到同样的问题并给出了解决方案,引起此错误的主要原因是在Mysql5.7版本中引入了SSL验证方式,如果不需要用到SSL验证,则在C#里拼写连接字符串时需要加入"SslMode=None"。具体解决方案可查看其原文:https://bugs.mysql.com/bug.php?id=76597。http://blog.csdn.net/fancyf/article/details/78295964


   I've identified the root cause of one case of this exception. If you always see this exception at the first connection to the database, my solutions may apply to you. 

The 3 possible solutions:
   Solution 1: If SSL is not required. Since it is caused by SSL, we can turn off SSL by appending "SslMode=None" to the connection string.
   Solution 2: If SSL is required, server identity is important and needs to be verified. Connect the server to the internet and try again. 
   Solution 3: If SSL is required but the server identity is not important. Typically SSL is only used to encrypt the network transport in this case. We can turn off CTL update:
1. Press Win+R to open the "Run" dialog 
2. Type "gpedit.msc" (without quotes) and press Enter
3. In the "Local Group Policy Editor", expand "Computer Configuration", expand "Administrative Templates", expand "System", expand "Internet Communication Management", and then click "Internet Communication settings".
4. In the details panel, double-click "Turn off Automatic Root Certificates Update", clickEnabled, then click OK. This change will be effective immediatelly without restart.

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有