Не удалось подключиться к хосту MYSQL
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MySql.Data.MySqlClient;
namespace ZApp
{
class DBMySQLUtils
{
public static MySqlConnection
GetDBConnection(string host, int port, string database, string username, string password)
{
// Connection String.
String connString = "Server=" + host + "; Port=" + port + "; Database=" + database + "; Uid=" + username + "; Pwd=" + password + ";";
MySqlConnection conn = new MySqlConnection(connString);
return conn;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MySql.Data.MySqlClient;
namespace ZApp
{
class DBUtils
{
public static MySqlConnection GetDBConnection()
{
string host = "http://web.hosting-minecraft.pro/phpmyadmin";
int port = 3306;
string database = "zapp";
string username = "zaralx";
string password = "Пароль пользователя через который я и вхожу туда";
return DBMySQLUtils.GetDBConnection(host, port, database, username, password);
}
}
}
public Form1()
{
InitializeComponent();
Console.WriteLine("Getting Connection ...");
MySqlConnection conn = DBUtils.GetDBConnection();
try
{
Console.WriteLine("Openning Connection ...");
conn.Open();
Console.WriteLine("Connection successful!");
}
catch (Exception e)
{
Console.WriteLine("Error: " + e.Message);
MessageBox.Show(e.Message);
}
Console.Read();
}