2

I have MySQL database at cloud which can be accessed using SSH tunnel. however i am using c# to connect to the database. i also installed SQL connector for visual studio as well.

Here are the steps i followed.

  1. Installed SQLYog for SSH client.
  2. tried to connect throughSQLYog. connection successful.
  3. tried to connect from c#. connection unsuccessful.

    Code :

       MySqlConnection myConn;
    
       string connStr = "server=localhost;user id=xxxxxxx;password=xxxxxxx;port=3306;persistsecurityinfo=False;";
    
       myConn = new MySqlConnection(connStr);
    
       myConn.Open();
    

    Exception :

    Unable to connect to any of the specified MySQL host.

shujaat siddiqui
  • 1,527
  • 1
  • 20
  • 41
  • possible duplicate of [Unable to connect to any of the specified MySQL hosts](http://stackoverflow.com/questions/4655669/unable-to-connect-to-any-of-the-specified-mysql-hosts) or [hosts file problem](http://stackoverflow.com/questions/6868784/mysql-exception-unable-to-connect-to-any-of-the-specified-mysql-hosts-through) – Armfoot Sep 17 '15 at 11:23
  • If you decide to evaluate dotConnect for MySQL, refer to our documentation: https://www.devart.com/dotconnect/mysql/docs/SecureConnections.html#usessh . The SSH support is available in Standard / Professional / Developer editions: https://www.devart.com/dotconnect/mysql/editions.html . – Devart Sep 17 '15 at 13:53
  • @Devart thanks for your answer. however i tried it in a different way like first i connect through SSH using putty on port 3306 than i exec queries through mysql library. – shujaat siddiqui Sep 21 '15 at 06:38

0 Answers0