我正在尝试创建我的测试WPF应用程序和MySql (phpmyadmin)数据库之间的连接。现在,我尝试了其他有类似问题的主题的所有建议,都没有奏效。
我有一个拥有所有权限的用户(http://prntscr.com/ehhrdv)和一个虚拟表。
我的连接代码如下所示:
string conectionString = "Server = r310.reseller.si; Database = ******; Uid = ******; Pwd = ******";
myConnection = new MySqlConnection(conectionString);
try { myConnection.Open(); } catch(MySqlException ex)
{
MessageBox.Show(ex.ToString());
}我得到的错误是:
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我不确定我的用户是否没有远程连接或其他权限。
我正在从我的工作的经销商网站管理数据库。
发布于 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
https://stackoverflow.com/questions/42675022
复制相似问题