You need this code:
var myConnectionString = "server=127.0.0.1;uid=root;pwd=12345;database=test;";
var conn = new MySqlConnection(myConnectionString);
conn.Open();
Also you need the public IP of the MySql server and the correct credentials (userid, password and database name).