Hi, i am trying to connect to a database(mysql), is this way right ?
I have added

using MySql.Data.MySqlClient;

I am getting a error on

Conni.Open();

, the error is saying: "Unable to connect to any of the specified MySQL hosts." Need help

string email = textBox1.Text;
            string password = textBox2.Text ;
            string password2 = textBox3.Text ;
            string fname = textBox4.Text;
            string lname = textBox5.Text;

            string CONFIG = "SERVER=localhost;" + "USERNAME=techozin;"+ "PASSWORD=waleed1984!;"+ "DATABASE=techozin_334900";
            MySqlConnection Conni = new MySqlConnection(CONFIG);
            MySqlCommand Querry = new MySqlCommand();
            Querry.Connection = Conni;
            Conni.Open();
            Querry.CommandText = "INSERT INTO mbmemer(email, password, firstname, lastname) VALUE(@email, @password, @firstname, @lastname)";
            Querry.Parameters.AddWithValue("@email", email);
            Querry.Parameters.AddWithValue("@password", password);
            Querry.Parameters.AddWithValue("@firstname", fname);
            Querry.Parameters.AddWithValue("@lastname", lname);
            Querry.ExecuteNonQuery();
            Conni.Close();

The standard connection string for MySql looks like this:
Server=myServerAddress; Database=myDataBase; Uid=myUsername; Pwd=myPassword;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.