0

I'm trying to learn to use C# with Visual Studio 2015 and the MySqlConnection.Open() method is taking over 15 seconds to establish the connection.

The program I've written simply establishes the connection and displays a message confirming connected or not. No queries, selection or anything else.

Does anyone know how to fix this issue. Could it be my TCP/IP settings? The port? Firewall? I'm not experienced with networking issues and I'm stumped and Google is not helping.

        try
        {
            string myConnection = "datasource=localhost;port=3306;username=root;password=root";
            MySqlConnection myConn = new MySqlConnection(myConnection);
            myConn.Open();
            MessageBox.Show("Connected");
            myConn.Close();
            MessageBox.Show("Disconnected");
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
DMcDonald
  • 89
  • 1
  • 14

0 Answers0