title: MySQL C# connection to localhost:'System.NullReferenceException'
body: <p>VS 2017 user here. I'm trying to connect a C# console app to MySQL 5.7. However there is no connection established. A suggeste solution is to look at undeclared objects, but I do not think that is the case here. Pls advise if it is.</p>
  
  <pre><code>MySqlConnection conn;
  string connStr = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
  
  public Connection()
  {
      conn = new MySqlConnection(connStr);
  }
  
  &lt;connectionStrings&gt;
  &lt;add name="myConnectionString"  
    connectionString="server=localhostdatabase=store;user=root;
    password=pass;port=3306" /&gt;
  &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>If I run this in the debugger I get the follow information on <code>conn</code>:</p>
  
  <pre><code>IsPasswordExpired' threw an exception of type 'System.NullReferenceException'
  ServerThread' threw an exception of type 'System.NullReferenceException'
  ServerVersion' threw an exception of type 'System.NullReferenceException'
  </code></pre>
  
  <p>There is very little to be found on this, just that the password was set one year ago (I do not really believe that is causing this problem) and some guy that solved it by reinstalling MySQL server. I did that, to no avail.</p>
  
  <p>From the command line everything is working fine.</p>