C#-Can';无法连接到远程MySQL服务器

C#-Can';无法连接到远程MySQL服务器,c#,mysql,C#,Mysql,我的问题是我无法连接到我的网站远程MySQL服务器。我已经在stackoverflow.com上阅读了所有答案,但我找不到正确的答案。这是我的C代码: 错误: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the inst

我的问题是我无法连接到我的网站远程MySQL服务器。我已经在stackoverflow.com上阅读了所有答案,但我找不到正确的答案。这是我的C代码:

错误:

A network-related or instance-specific error occurred while establishing a 
connection to SQL Server. The server was not found or was not accessible.
Verify that the instance name is correct and that SQL Server is configured
to allow remote connections. (provider: Named Pipes Provider, error: 40
Could not open a connection to SQL Server)
有什么想法吗?

试试下面的方法

string connectionString = @"Server=[IP adress]:3306;Database=[database];Uid=[user];Pwd=[pass];";
而不是

 string connectionString = @"Server=[IP adress];Port=3306;Database=[database];Uid=[user];Pwd=[pass];";

当连接到MySQL数据库时,我总是使用MySQL连接器,您可以在这里获得:

您必须将MySQL名称空间导入到项目中,然后才能使用MySQLConnection而不是SQLConnection,据我所知,SQLConnection仅适用于MSSQL服务器


“有什么想法吗?”-
关键字不受支持:“端口”。
我猜
端口
关键字不受支持。您是否尝试了连接字符串而未指定端口?确实:3306是默认端口,因此请尝试删除它。我已向我的托管公司寻求帮助,因此他们说我需要使用端口3306。错误消息非常清楚。。。尝试通过在IP地址末尾添加“:[PortNumber]”来指定端口。如下所示:
Server=[IP address]:3306
@Robis您无需花费任何费用即可尝试。错误:无法连接到任何指定的MySQL主机。MySQLConnection的语法可能与SQLConnection不同。
 string connectionString = @"Server=[IP adress];Port=3306;Database=[database];Uid=[user];Pwd=[pass];";