-3

I want to connect to a disant mysql database wich is located in another server using Asp.net C#. How can i did it ? Thanks.

1
  • 1
    i think its easier to type the same title in google than SO. Commented Jul 27, 2016 at 8:02

1 Answer 1

0

You need this code:

var myConnectionString = "server=127.0.0.1;uid=root;pwd=12345;database=test;";
var conn = new MySqlConnection(myConnectionString);
conn.Open();

Also you need the public IP of the MySql server and the correct credentials (userid, password and database name).

Sign up to request clarification or add additional context in comments.

2 Comments

as additional info: it's important, that your IP is allowed to connect to the distant mysql-server by the server. Can be a pun not knowing this.
i'll try it. thanks :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.