Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# MySQL
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.
 

<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 to any of the specified MySQL hosts
".
Posted 30-Aug-12 20:40pm
Edited 30-Aug-12 21:10pm
v2
Comments
Zoltán Zörgő at 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 at 31-Aug-12 2:07am
   

 
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ő at 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?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi there,
 
As you have stated that you're to using MySQL server, use try using this format of connection string:
 
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!
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I hope this will help.
  Permalink  

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



Advertise | Privacy | Mobile
Web02 | 2.8.150129.1 | Last Updated 31 Aug 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100