Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a C# Application which would access a MySQL server using WAMP on another computer. I am trying to do it via IP. Here is my Connection String :
C#
server = "192.168.10.221";
database = "restaurantdb";
uid = "root";
password = "";
string connectionString;
connectionString = "SERVER=" + server + "; PORT = 3306 ;" + "DATABASE=" + database + ";" + "UID=" + uid + ";" + "PASSWORD=" + password + ";";
mycon = new MySqlConnection(connectionString);


I have another computer in which we are in the same network, but when I try to connect to the Mysql I am not able to connect but locally it works...
What do you think ?

What I have tried:

I published my C# application and then launch it in the other computer so that I will try to connect to mysql but nothing works. But I have to mention that when I put the ip adress in the other computer I can have access to wampserver and phpmyadmin ...
Posted
Updated 27-Oct-16 4:07am

Put a try/catch block around your code , and it will tell you exactly what's wrong. My guess is that it's a permissions problem.
 
Share this answer
 
I got this error...MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.
 
Share this answer
 
Comments
[no name] 27-Oct-16 10:12am    
THIS is the solution to your problem?
TatsuSheva 27-Oct-16 10:20am    
No... but I can't write a comment in the solution above
[no name] 27-Oct-16 10:29am    
That is exactly why you have the ability to edit your question and improve the content to provide the information that people need to see to help you with your problem.
TatsuSheva 27-Oct-16 10:34am    
So, what should I do now ? I am blocked with this issue :/
[no name] 27-Oct-16 12:42pm    
Well, if I were you, I would do what I already told you to do. Then I would google your error message and start looking at the same difficulties that others had had doing the exact same thing that you are doing and seeing what they did to fix it. Then I would start actually doing some of those things to see if if fixes my problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900