title: Connecting to MySQL server via C#
body: <p>This is my code that is meant to connect to a MySQL server and fetch some info:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Text;
  using System.Data.SqlClient;
  
  namespace test_MLDropCopy
  {
      class Program
      {
          static void Main(string[] args)
          {
              string connectionString = "server=xxxxx;uid=xxxxx;pwd=xxxxx";
  
              SqlConnection mySqlConnection = new SqlConnection(connectionString);
  
              string selectString = "select Symbol from today_positions.all_rttp where ServiceName like 'ML%' and ID = 137800";
  
              SqlCommand mySqlCommand = mySqlConnection.CreateCommand();
  
              mySqlConnection.Open(); 
  
              mySqlCommand.CommandText = selectString;
  
              SqlDataReader myReader = null;
  
              myReader = mySqlCommand.ExecuteReader();
  
              string Symbol = myReader["Symbol"].ToString();
  
              Console.WriteLine(Symbol);
  
              mySqlConnection.Close();
  
  
          }
      }
  }
  </code></pre>
  
  <p>However, this is the error I'm getting:</p>
  
  <pre><code>Unhandled Exception: System.Data.SqlClient.SqlException: A network-related or in
  stance-specific error occurred while establishing a connection to SQL Server. Th
  e server was not found or was not accessible. Verify that the instance name is c
  orrect and that SQL Server is configured to allow remote connections. (provider:
   Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
  </code></pre>
  
  <p>I have double checked the login credentials I am using. Is there a problem in my code, or is the problem from the database end (offline, inadequate permissions etc.) ?</p>