Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

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.

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.

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"

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.

My connection string contains server, port, uid, password,Connection timeout, database, pooling

More details :

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 ?

like image 331
S_BatMan Avatar asked Jun 18 '12 12:06

S_BatMan


1 Answers

Try to add "TrustedConnection" as "True" to your connection string. Also make sure you are building as x86 not "Any Cpu". Hope it helps

like image 188
Kryštof Hilar Avatar answered Oct 10 '22 09:10

Kryštof Hilar