asp.net 连接 Mysql 
<add name="MySQLConnString" connectionString="server=localhost; user id=root; password=sa; database=qf_shop" providerName="MySql.Data.MySqlClient"/>
以上的是本地的,很正常<add name="MySQLConnString" connectionString="server=mysql0.100ws.com; user id=lonbia_qfdb; password=123; database=lonbia_qfdb" providerName="MySql.Data.MySqlClient"/>以上的代码是远程的,报错是:
[Exception: 引发类型为“System.Exception”的异常。]
   MySql.Data.MySqlClient.NativeDriver.Open() +110[MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.]
   Dtsc.Common.Utility.MySQLHelper.ExecuteReader(CommandType cmdType, String cmdText, MySqlParameter[] commandParameters) in E:\workspace\千芳\QianFang\ACL-UTILITY\Dtsc.Common.Utility\Helper\MySQLHelper.cs:163
.............连不上主机...请指教,小弟先谢了

解决方案 »

  1.   

    远程的防火墙有没有开对应的端口 3306 ,看能不能ping通
      

  2.   

    引用
    MySql.Data.MySqlClient  dll
      

  3.   

    我可以连接:Phpmysqladmin进行数据库的管理.表已经加上去了.  为啥还会报这样的错了?
    3306应该打开了.
    MySql.Data.MySqlClient  dll这个也引用了.
      

  4.   


    异常详细信息: System.Net.Sockets.SocketException: 不知道这样的主机。
      

  5.   

    Unable to connect to any of the specified MySQL hosts
    意思是连不上数据库啊
    server=mysql0.100ws.com;换成服务器IP呢
      

  6.   

    http://www.connectionstrings.com/?carrier=mysql
      

  7.   

    <add name="MySQLConnString" connectionString="server=222.240.174.98:3307; user id=qianfang; password=2450030; database=qianfangdb" providerName="MySql.Data.MySqlClient"/>
    还是不行哟.
      

  8.   

    <appSettings>
    <add key="Connection" value="Server=127.0.0.1;User ID=root;Password=;Database=box;CharSet=gb2312;"/>
    </appSettings>
    我通常这样写
      

  9.   

    CharSet=gb2312 
    加了这个.就行了.楼上的.太感谢了/