title: What may cause the KeyNotFoundException when trying to open a MySQL connection
body: <p>I trying to connect my database using C# code, but getting a KeyNotFoundException when the debugger gets to MySqlConnection Open method.</p>
  
  <p>I Have tried changing my connectionString to another template, restarting my SQL server, and manually validating my server details (Username, Password ETC...)</p>
  
  <pre><code>//setting my connection data
  private void Initialize() {
      server = "127.0.0.1";
      database = "database";
      uid = "root";
      password = "123456";
      String connectionString;
      connectionString = "SERVER=" + server + ";" + "DATABASE=" +
      database + ";" + "Uid=" + uid + ";" + "PWd=" + password + ";";
      connection = new MySqlConnection(connectionString);
  }
  
  
  //Opening the connection
  private bool OpenConnection() {
      try {
          connection.Open();//This is where I get my Exception
          return true;
      }
  }
  </code></pre>
  
  <p>As I except connection I am getting the next Exception:</p>
  
  <blockquote>
    <p>System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
    at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
    at MySql.Data.MySqlClient.CharSetMap.GetCharacterSet(DBVersion version, String CharSetName)
    at MySql.Data.MySqlClient.CharSetMap.GetEncoding(DBVersion version, String CharSetName)
    at MySql.Data.MySqlClient.Driver.Configure(MySqlConnection connection)
    at MySql.Data.MySqlClient.MySqlConnection.Open()
    at sqlTesting.DBConnect.OpenConnection() in d:\Users\moshe\Documents\Visual Studio 2015\Projects\sqlTesting\sqlTesting\DBConnect.cs:line 40</p>
  </blockquote>
  
  <pre><code>
  </code></pre>