Q: connect to MySQL webserver with C# I try to connect to a MySQL database on a server a friend of mine has created, but it still says it cannot connect to the server!
Here is my code:
        String connectionString = "Persist Security Info=False;database=qwertyui;server=www.qwertyuiop.com;Uid=asdfghj;Pwd=qazwsxedc;Connect Timeout=30";
        using (SqlConnection connection = new SqlConnection(connectionString))
        {
            SqlCommand cmd = new SqlCommand("INSERT INTO etc.... ");
            cmd.CommandType = CommandType.Text;
            cmd.Connection = connection;
            cmd.Parameters.AddWithValue( etc.... );
            connection.Open();
            int r = cmd.ExecuteNonQuery();
        }

It failes on the connection.Open() instruction throwing an exception -> cannot connect to the server.
Any ideas please?

A: SqlConnection is a SQL Server client.
You need to download a MySql client from NuGet.

A: *

*First download the MySQL Connector.

*Make sure you add a reference to the DLL (+ set copy local to true !)

*Add using MySql.Data.MySqlClient; on top of your class.

*As for the Connection String, do not add http or www in front of server. As it will try to connect to apache (port 80) instead to MySQL. The default port of MySQL is 3306.
string connectionString = "Persist Security Info=False;database=qwertyui;server=qwertyuiop.com;Uid=asdfghj;Pwd=qazwsxedc;port=3306";
using (MySqlConnection connection = new MySqlConnection(connectionString))
{
    string query = "INSERT INTO table VALUES (@parameter)";
    connection.Open();
    using (MySqlCommand cmd = new MySqlCommand(query, connection))
    {
        cmd.Parameters.AddWithValue("@parameter", parameter);
        cmd.ExecuteNonQuery();
    }
}

If this is not working. Make sure MySQL allows remote access, if this is not the case, you can keep trying forever without any result.

A: First thing that comes to mind is that you will have to use a MysqlConnection and command.
http://dev.mysql.com/doc/refman/5.0/es/connector-net-examples-mysqlconnection.html
Is it a local database?

A: And if with all of above does not work try to get grant to all privileges(GRANT Syntax)!
Basically it will go something like:
GRANT ALL PRIVILEGES ON DBname.* to 'username'@'IPadress' IDENTIFIED BY 'password';

