Click here to Skip to main content
15,895,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am using mysql for db, am trying to connect mysql remotly using IP address,
please help me how to connect to mysql remotly using c# and am using windows7 os.


XML
<add name="MySqlConnection" connectionString="Data Source=localhost;Initial Catalog=DbName;Username=Username;Password=1234;Pooling=false;Max Pool Size=500;Min Pool Size=1;"
      providerName="MySql.Data.MySqlClient" />


This is my connection string for connectiong for mysql db. inpalce of "Data Source=localhost" i want to give IP address.
i tried giving ip address but it is not connecting, it is giving erros as "
C#
Unable to connect to any of the specified MySQL hosts
".
Posted
Updated 30-Aug-12 20:10pm
v2
Comments
Zoltán Zörgő 31-Aug-12 2:01am    
what have you tried so far? Any error message? Since in theory it is just a matter of connection string and driver" installation...
NaveenWin 31-Aug-12 2:07am    
<add name="MySqlConnection" connectionstring="Data Source=localhost;Initial Catalog=DbName;Username=Username;Password=1234;Pooling=false;Max Pool Size=500;Min Pool Size=1;"
="" providername="MySql.Data.MySqlClient">

This is my connection string for connectiong for mysql db. inpalce of "Data Source=localhost" i want to give IP address.
i tried giving ip address but it is not connecting, it is giving erros as unable to connect mysql server.
Zoltán Zörgő 31-Aug-12 2:11am    
Ok , but are you sure that your provider has left open the tcp ports for the MySQL server? Or both the application and the database server are on the same intranet, without any firewall between?

Hi there,

As you have stated that you're to using MySQL server, use try using this format of connection string:

C#
ConnectionString="server=192.168.1.1;database=test;uid=test;password=test;pooling=false;";

Replace "192.168.1.1" with your actual MySQL server IP address.

Hope this helps.

Happy Coding!
 
Share this answer
 
v2
I hope this will help.
 
Share this answer
 

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