In this quick tutorial I’m going to show you how you can connect your c# application to a remote mysql database. There’s no additional coding involve in this tutorial all you need to do is to configure your connection string a little bit and configure the privileges on your mysql database.
First you have to access your mysql database using phpmyadmin.
Click on the privileges tab then change the host to Any host.
Finally you just have to change the server you’re connecting to. This time its not localhost since you’re not connecting to the database on your local computer.
string con_string = "Server=192.168.218.10;
In the example above I used the internal ip address. If you don’t know your internal ip address. Just go to cmd and type ipconfig/all and copy the ip version 4 preferred address. Well that’s just internal ip address, which means that only the people who are inside your home network can access. If you want to connect to a remote mysql database you have to determine your external ip address, you can do so by going to cmyip.com. But remember that the ip address of the computer you’re trying to access should be static so that you won’t need to change your connection string every time you need to connect to the remote mysql database.
I have written a tutorial before on how to connect to a remote computer. You might want to read it if you don’t know how to configure your router to make remote access possible.