Forums

Help, I need to connect my desktop application to my mysql database

Hello, I'm a newbie and I'm using my django project with a mysql database from here but i also need to connect my desktop application to my mysql database, i think I'm taking some data wrong, can someone instruct me on how to do it right?

my application uses c# and this is the connection class and for obvious reasons i removed the password

internal class Conexion
{
    static MySqlConnection Conex = new MySqlConnection();

    static string serv = "Server=krorellana8.mysql.pythonanywhere-services.com;";
    static string db = "Database=krorellana8$wea;";
    static string usuario = "UID=krorellana8;";
    static string pwd = "Password =;";
    static string po = "PORT =3306;";

    string CadenaDeConexion = serv + db + usuario + pwd + po;


    public MySqlConnection establecerConexion()
    {
        try
        {
            Conex.ConnectionString = CadenaDeConexion;
            Conex.Open();
            MessageBox.Show("Conectado");
        }
        catch (Exception)
        {
            MessageBox.Show("No conectado");
        }

        return Conex;

    }

    public void cerrarConexion()
    {
        Conex.Close();
    }

}

i get this message "unable to connect to any of the specified mysql hosts".

You need to connect via an SSH tunnel, see this help page.