C# MySql.Data.MySqlClient.MySqlException (0x80004005)
With mysql on C# you don't need single quote in the connexion string
Ex :
ConnStr = "Server = XXX.XXX.XXX.XXX; Database = mydatabase; Uid = root; Pwd = yourpassword";
MySqlConnection con = new MySqlConnection(ConnStr)
You can also verify that you can ping the other computer :
using System.Net.NetworkInformation;
public static bool IsConnectedToServer()
{
Ping p = new Ping();
try
{
PingReply reply = p.Send("XXX.XXX.XXX.XXX", 3000);
if (reply.Status == IPStatus.Success)
return true;
else return false;
}
catch { return false; }
}
Eljey Shikaku
Updated on June 04, 2022Comments
-
Eljey Shikaku almost 2 years
here's my connection string
"Server=xxx.xxx.xxx.x;Database=database;Uid='root';Pwd='';"
the ip on the server is the ip of the other computer(have xampp) that I want to access.
this is the Exception I receive.
MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts. at MySql.Data.MySqlClient.NativeDriver.Open() at MySql.Data.MySqlClient.Driver.Open() at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() at MySql.Data.MySqlClient.MySqlPool.GetConnection() at MySql.Data.MySqlClient.MySqlConnection.Open()