.net连接MySql:Unable to connect to any of the specified MySQL hosts
来源:互联网 发布:vb进度条控件源码 编辑:程序博客网 时间:2024/04/30 14:21
此问题扰民大发了。
最终毙之:
2011-11-2 16:24:56:MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.Net.Sockets.SocketException: 通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 127.0.0.1:3307 在 System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) 在 MySql.Data.Common.StreamCreator.CreateSocketStream(IPAddress ip, Boolean unix) 在 MySql.Data.Common.StreamCreator.GetStream(UInt32 timeout) 在 MySql.Data.MySqlClient.NativeDriver.Open() --- 内部异常堆栈跟踪的结尾 --- 在 MySql.Data.MySqlClient.NativeDriver.Open() 在 MySql.Data.MySqlClient.Driver.Open() 在 MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) 在 MySql.Data.MySqlClient.MySqlConnection.Open() 在 PubFun.ConData.ExcSQL(String sql, Int32 timeOut)在网上搜索了很多原因:
1. mysql.data.dll 服务器端和客户端版本不对应。 别人说的我没有明白,mysql.data.dll版本好像只有应用程序这一端才会用吧。其他地方不用啊。
mysql安装在服务器端后,有这个东东吗?不知道。再议。
也有人说,换个mysql.data.dll的版本就好了,但是我用.net framework3.5,试了几个版本后,发现编译不过去。所以,再议。
2. mysql 链接字符串
最初链接:
ConstPar.mysqlconstr = "server=" + ConXML.GetNodeValue("//DataBase", "ip") + ";user id=" + ConXML.GetNodeValue("//DataBase", "user") + ";password=" + ConXML.GetNodeValue("//DataBase", "psd") + ";pooling=false;Port=" + ConXML.GetNodeValue("//DataBase", "port");
修改为:
ConstPar.mysqlconstr = "server=" + ConXML.GetNodeValue("//DataBase", "ip") + ";user id=" + ConXML.GetNodeValue("//DataBase", "user") + ";password=" + ConXML.GetNodeValue("//DataBase", "psd") + ";pooling=false;Port=" + ConXML.GetNodeValue("//DataBase", "port")+";CharSet=utf8;Allow Zero Datetime=true";
3. mysql链接字符串。
最终修改为:
ConstPar.mysqlconstr = "server=" + ConXML.GetNodeValue("//DataBase", "ip") + ";user id=" + ConXML.GetNodeValue("//DataBase", "user") + ";password=" + ConXML.GetNodeValue("//DataBase", "psd") + ";pooling=true;Port=" + ConXML.GetNodeValue("//DataBase", "port")+";CharSet=utf8;Allow Zero Datetime=true";
有朋友该说了,这不和2中修改后的一样吗?
请注意:pooling=true;
最后,修改这个后,再也没有出现上面的问题了。
- .net连接MySql:Unable to connect to any of the specified MySQL hosts
- Unable to connect to any of the specified MySQL hosts.
- Unable to connect to any of the specified MySQL hosts.
- VS连接MySQL·:Unable to connect to any of the specified MySQL hosts(VS连接MySQL出错)
- mysql MySql Login Unable to connect to any of the specified MySQL hosts
- C#操作mysql数据库 unable to connect to any of the specified mysql hosts
- Visual Studio 2010--报错mysql:Unable to connect to any of the specified MySQL hosts
- Unable to connect to any hosts due to exception: java.net.ConnectException:...问题的解决
- Unable to connect to specified host. 错误
- Unable to locate any of the following operational binaries 解决方法
- ADO.NET实体框架连接串引发的异常:Unable to load the specified metadata resource
- ADO.NET实体框架连接串引发的异常:Unable to load the specified metadata resource
- Could Not Connect To The Specified Instance - MySQL Error Number 2003 - (10061)问题
- Failed to connect to the session manager: None of the authentication protocols specified are support
- Is there any best way to reduce the size of ibdata in mysql.?
- 装mysql时,报unable to find a version of the runtime to run this application
- 安装mysql时,报“unable to find a version of the runtime to run this application ”
- Unable to locate JAR/zip in file system as specified by the driver definition: mysql-connector-java-
- fedora server command list
- Cocos2d的基本概念
- USB2.0接口差分信号线设计
- /var/log/secure不记录日志
- 如何Lotus iNotes Lotus Domino Sync Manager和使用中做邮件归档
- .net连接MySql:Unable to connect to any of the specified MySQL hosts
- OPENGL填充区属性函数(一)
- 性能自动化测试方略
- linux设备驱动归纳总结(一):内核的相关基础概念
- LambdaProbe 监控Tomcat使用详解
- DNS负载均衡与CDN内容分发技术
- Android线程优先级设置方法
- linux设备驱动归纳总结(二):模块的相关基础概念
- LightSwitch登录界面如何设置背景