r.vengadesh
r.vengadesh

Reputation: 1837

Unable to connect to any of the specified MySQL hosts in c# windows form

I want to connect my windows form application to mysql .It works local mysql server perfectly.But it didn't work in online mysql.

My code is

string mysqlconnection = "Server=mysql.main-hosting.com;Database=xxxxxxxxx;Uid=yyyyyyy;Password=zzzzzzzz;";
MySqlConnection connection = new MySqlConnection(mysqlconnection);
connection.Open();

It shows Unable to connect to any of the specified MySQL hosts..How to solve this?

Upvotes: 0

Views: 1108

Answers (1)

Orlando Helmer
Orlando Helmer

Reputation: 503

Try

Server=mysql.main-hosting.com;Database=xxxxxxxxx;User ID=yyyyyyy;Password=zzzzzzzz;

Instead of

Server=mysql.main-hosting.com;Database=xxxxxxxxx;Uid=yyyyyyy;Password=zzzzzzzz;

Maybe it is a connectionstring problem.

Or otherwise the server address is wrong.

Upvotes: 1

Related Questions