FoldFence
FoldFence

Reputation: 2802

Universal App MySQLConnector Connection error

I try to use the MySQLConnector to connect on my mysql database on a vserver with phpAdmin. I used different logins to check if the password and the ip is correct and after a view tries i get the

Error:

enter image description here

Code:

    static string server = "999.999.999.20";
    static string database = "admin_";
    static string user = "root";
    static string pswd = "secret";

    public static void login()
    {
        string connectionString = "Server = " + server + ";database = " 
    + database + ";uid = " + user + ";password = " + pswd + ";"
    +"SslMode=None;";
        using (MySqlConnection connection = new MySqlConnection(connectionString))
        {
            connection.Open();

The Exception is thrown at "Connection.Open();". The Connection String seems Correct because when I delete SSL Mode or Something else I get the specific Exception. I use the Recerense to MySql.Data.RT

My Question is:

What does the Exception mean or what should I specifiy on the Server ?

Upvotes: 0

Views: 190

Answers (1)

Cihan Uygun
Cihan Uygun

Reputation: 2138

I think this is related with your OS culture and assuming that mysql connector is setting the encoding referencing with OS's culture. Please can you add the encoding directive to your connection string like below;

static string server = "999.999.999.20";
static string database = "admin_";
static string user = "root";
static string pswd = "secret";

public static void login()
{
    string connectionString = "Server = " + server + ";database = " 
    + database + ";uid = " + user + ";password = " + pswd + ";"
    +"SslMode=None;"
    +"CharSet=utf8;";
    using (MySqlConnection connection = new MySqlConnection(connectionString))
    {
        connection.Open();

PS: The encoding on your database is important, I assume you are using UTF8

Upvotes: 1

Related Questions