Quote
MySqlConnection connection = new MySqlConnection("Server=mysql.com;port=3306;username=MyUserName;password=MyPassword");
My question is what should be Server name for mysql.com???
Server is the
name of the computer on which the MySQL Server is installed and running. If your server computer is named
Svr123456@my.company.com, your connection string would start with
Server=Svr123456@my.company.com;
Quote
I am trying to connect with a C# code from any PC worldwide.
This is generally considered to be a Bad Idea.
The Internet is
full of nasty things looking for vulnerabilities to attack. As soon as they find a MySQL database running on your server, they'll start trying to find a way into it. That might trash your application's performance or your data might changed unexpectedly or your data might suddenly appear, published, out on the Internet (and landing you in very hot water, legally).
The
accepted way to build "Internet-enabled" applications is to use a web server to act as an "intermediary". Your Clients' web browsers talk to the web server(s) and the web server(s) then talks to the Database.
Web servers are
built to survive in the dangerous, hack-ridden World that is the Internet; simply put, Databases are not.
You should also consider that anything running "out there" (i.e. not on your computer that you control) should be
implicitly untrusted - absolutely anything could open a connection to your [web-exposed] database - you cannot assume that it will be
your application at the other end.
Regards, Phill W.