Unable to connect to any of the specified MySQL hosts

Hello to everyone,

From time to time I get an error like the following on my MySQL server, why does it give this error, I can’t see any problems in the logs.


Unable to connect to any of the specified MySQL hosts. → One or more errors occurred. → No connection could be made because the target machine actively refused it

@Aleksandra_Abramova Aleksandra_Abramova @Michael_Coburn Michael_Coburn

1 Like

Hi @buyuk_basri
What is bind_address configured to? you need it listening at least on an IP that can be routed from your application

1 Like

In some of the ways, spacing and the order of parameters in the MySql connection string does matters. So, stick to the standard format:

MysqlConn.ConnectionString = "Server=localhost;Port=1234;Database=My_Mysql_Database;Uid=root;Pwd=root;"

If the above connection string fails, try update your c# mysql connection string as shown below (without port variable as well):

MysqlConn.ConnectionString = "Server=localhost;Database=My_Mysql_Database;Uid=root;Pwd=root;"

Or, sometime the problem could be on your windows firewall, make sure your server allow access to all port associated with your mysql database.