[英]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. 我想将Windows窗体应用程序连接到mysql。它可以完美地在本地mysql服务器上工作,但是在在线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. 它显示无法连接到任何指定的MySQL主机。 .How to solve this?
。如何解决?
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. 否则,服务器地址错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.