简体   繁体   English

C#Mono MySql连接器:无法连接到任何指定的MySQL主机

[英]C# Mono MySql connector :Unable to connect to any specified MySQL hosts

I'm assuming this is a bug with the MySQL connector with mono but i thought i'd ask incase somone has found a work around. 我假设这是MySQL连接器与单声道的错误,但我想我会问incase somone找到了解决方法。

I have a VS solution running .net 4(latest mono), i'm using the latest version of the MySQL connector fresh off their website this morning. 我有一个VS解决方案运行.net 4(最新的单声道),我今天早上在他们的网站上使用最新版本的MySQL连接器。

If I open the project with visual studio , compile and run the MySQL connector connects to the MySQL database almost instantly and all is well. 如果我用visual studio打开项目,编译并运行MySQL连接器几乎可以立即连接到MySQL数据库,一切都很顺利。

If I open the exact same project in MonoDevelop (causing it to be built with mono rather then MS .net4) with not a single line of code changed, the MySQL connector reply's with "Unable to connect to any specified MySQL hosts" 如果我在MonoDevelop中打开完全相同的项目(导致它使用单声道而不是MS .net4构建)而没有更改一行代码,则MySQL连接器回复“无法连接到任何指定的MySQL主机”

This cannot be a database problem else I would be seeing the problem on both builds. 这不能是数据库问题,否则我会在两个版本中看到问题。 Even remaining in MonoDevelop and building with the MS .net framework from there still results in a good connection. 即使留在MonoDevelop并使用MS .net框架进行构建仍然会产生良好的连接。

My connection string contains server, port, uid, password,Connection timeout, database, pooling 我的连接字符串包含服务器,端口,uid,密码,连接超时,数据库,池

More details : 更多细节 :

Windows 7 x64 visual studio 2010 Mono 2.10.8 MonoDevelop 3.0.2 Windows 7 x64 visual studio 2010 Mono 2.10.8 MonoDevelop 3.0.2

I've seen a large number of results from googling my question, but they all seems to be differing issues, or due to old bugs that have since been fixed by method's that certainly haven't worked in this case. 我通过谷歌搜索我的问题看到了大量的结果,但它们似乎都是不同的问题,或者由于已经被方法修复的旧错误在这种情况下肯定没有用。

Edit : can anyone replicate what I am seeing here ? 编辑:任何人都可以复制我在这里看到的内容吗?

Try to add "TrustedConnection" as "True" to your connection string. 尝试将“TrustedConnection”添加为“True”到您的连接字符串。 Also make sure you are building as x86 not "Any Cpu". 还要确保您构建为x86而不是“Any Cpu”。 Hope it helps 希望能帮助到你

Check http://www.mono-project.com/MySQL for MySQL specific instructions. 有关MySQL的具体说明,请访问http://www.mono-project.com/MySQL Specifically make sure that MySql.data.dll is in the GAC: 特别要确保MySql.data.dll在GAC中:

cd path_to_your MySql.Data.dll assembly
gacutil -i MySql.Data.dll

There is also some example code on the site that may help. 网站上还有一些示例代码可能有所帮助。

Best of luck. 祝你好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM