Click here to Skip to main content
15,893,663 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to connect remote mysql database using windows forms application.

i connected local database to windows application.But i want to connect remote database using windows forms application.
Posted
Updated 4-Jun-13 1:18am
v5
Comments
dan!sh 4-Jun-13 5:36am    
ConnectionStrings.com is your friend.
Mohibur Rashid 5-Jun-13 5:42am    
download mysql srouce, then add the include path to your project, add the libmysqld.lib to your project, copy libmysqld.dll to your program dirctory. include mysql.h, make sure windows.h is included before mysql.h, connect and compile

Modify your connection string like this:
C#
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

If you are using a tcp port then:
C#
Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword;



--Amit
 
Share this answer
 
Hi,

Enter the remote machine's IP address, user name and password in connection string of your application.

Note : the remote machine should have a static ID address....
 
Share this answer
 
MySqlConnection con = new MySqlConnection("server=serverip;User ID=root;Password=password;database=abc;pooling=false;Allow Zero Datetime=True;");

it is connected to the remote database.
 
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