Reputation: 71
Good day; I am making an C# desktop application using MySQL as database. The execution works fine when using local server "localhost", but I want to install it in other computers and keep the database in my computer. I proceeded like following to allow other computers to connect the database :
String connString = "Server = '192.168.xxx.xxx'; " + "Port = '3306'; " + "Database = 'mydb'; " + "uid = 'dbUser'; " + "pwd = 'userPassword';" + "Persist Security Info=true;";
From the computer in which the database is installed, I can execute without any problem but from other computers I can not connect to the database. It gave me the error :
Unable to connect to any of the specified MySQL hosts.
Can anyone help me please ?
Upvotes: 1
Views: 804
Reputation: 71
Finally, I resolved the problem. The problem was the port 3306 should be authorized by the firewall of the computer in which the database is installed. For those who got the same problem, this is the way how to resolve it :
firewall
>> Advanced settings
Inbound Rules
and choose the first option New Rule
.Port
, then click Next buttonTCP
option is checked, then check Specific local ports
and add the port 3306. Then Next and the port 3306 will be authorized and the connection from other computers permitted.Upvotes: 1