无法连接到 WPF 中指定的任何 MySQL 主机

Unable to connect to any of the specified MySQL hosts in WPF

我不知道连接字符串有什么问题。我尝试了字符串的所有可能变体。它是在 vs 2015 的 WPF 框架中完成的。我刚刚安装了 SQL server 2016。

密码是:

string ConnectionString = "Server=localhost;Port=3306;Database=EliseDB;Uid=root;Pwd=";
MySqlConnection conn = new MySqlConnection(ConnectionString);
conn.Open();

显示的错误是:

'MySql.Data.MySqlClient.MySqlException' in MySql.Data.dll

An exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll but was not handled in user code

附加信息:

Unable to connect to any of the specified MySQL hosts.

我什至尝试在服务器配置管理器中重新启动 TCP/IP。

参考:https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection(v=vs.110).aspx

类似于以下内容:

string connectionString = "Data Source=localhost, 3306;
Initial Catalog=EliseDB;User ID=root"

SqlConnection cnn = new SqlConnection(connectionString)

try
{
    cnn.Open();
    MessageBox.Show("Opened connection!");
    cnn.Close();
}
catch (Exception ex)
{
    MessageBox.Show("Big Problem: " + ex.message);
}