首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >连接到远程MySQL数据库

连接到远程MySQL数据库
EN

Stack Overflow用户
提问于 2017-03-08 23:13:42
回答 1查看 70关注 0票数 0

我正在尝试创建我的测试WPF应用程序和MySql (phpmyadmin)数据库之间的连接。现在,我尝试了其他有类似问题的主题的所有建议,都没有奏效。

我有一个拥有所有权限的用户(http://prntscr.com/ehhrdv)和一个虚拟表。

我的连接代码如下所示:

代码语言:javascript
复制
string conectionString = "Server = r310.reseller.si; Database = ******; Uid = ******; Pwd = ******";



         myConnection = new MySqlConnection(conectionString);

        try { myConnection.Open(); } catch(MySqlException ex)
        {
            MessageBox.Show(ex.ToString());
        }

我得到的错误是:

代码语言:javascript
复制
 MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.
   at MySql.Data.MySqlClient.NativeDriver.Open()
   at MySql.Data.MySqlClient.Driver.Open()
   at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
   at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
   at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
   at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
   at MySql.Data.MySqlClient.MySqlPool.GetConnection()
   at MySql.Data.MySqlClient.MySqlConnection.Open()
   at WpfApplication2.MainWindow.pressMe_Click(Object sender, RoutedEventArgs e) in C:\Users\Tomi\Documents\Visual Studio 2015\Projects\WpfApplication2\WpfApplication2\MainWindow.xaml.cs:line 51

我不确定我的用户是否没有远程连接或其他权限。

我正在从我的工作的经销商网站管理数据库。

EN

回答 1

Stack Overflow用户

发布于 2017-03-08 23:33:51

尝试添加:

Driver={SQL Server Native Client 11.0};

在连接字符串的开头,即:

11.0};Server=r310.reseller.si;Database=******;Uid=******;Pwd=******";conectionString = "Driver={SQL Server Native Client string

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42675022

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档