0

I use MySQL .NET Connector to communicate with the mysql server. And everything is fine if I set the connection string as:

<add key="ConnectionString" value="Server = localhost; Port = 3306; Database = test; Uid = root; Pwd = root;" />

I'm going to use my program to reach the MySQL Server remotely from another location. How will the connection string supposed to be set in this case? I tried:

... Server = http://localhost; Port = ...

just as experimenting, but didn't work. Thank you.

Mitulát báti
  • 2,086
  • 5
  • 23
  • 37
  • 1
    `localhost` is the symbolic name for your machine, just enter the remote server's name or IP address there, like `Server = superawesomedatabaseserver.example.com` – fvu May 13 '14 at 12:27
  • And how can I set the server to allow connections (or even be visible) by other remote machines? – Mitulát báti May 13 '14 at 12:29
  • Answered here http://stackoverflow.com/questions/16287559/mysql-adding-user-for-remote-access – jdiver May 13 '14 at 12:33
  • That's a totally different (and as a non-programming related issue, offtopic for SO) issue, highly dependent on how the remote server is connected to the internet, but very well documented all over the internet - just punch "mysql server allow remote connections" in your preferred search engine. – fvu May 13 '14 at 12:33

1 Answers1

0

Server = localhost specifies the name of the server connected to. In this case it refers to localhost a special name which always refers to the local computer regardless what it is actually called.

You can change this value to the NETBIOS name, DNS name or IP address of the server.

Ashigore
  • 4,618
  • 1
  • 19
  • 39