简体   繁体   中英

How can connect MySql Online Database to C# desktop application

I am creating desktop application in c# but i wont to use Online Database created in mysql.

String mysqlConnectionString = "Server=216.14.120.105;Database=xxx_keys;UID=xxx_root;Password=xxx;Port=3306";
MySqlConnection connection = new MySqlConnection(mysqlConnectionString);
connection.Open();

this is the code i am using but i got an error unable to access host.

where i am wrong and if you have any proper code or details then give me.

If this is a MySQL database in local server user "localhost" for server IP as georgi-it also told. But if this is an external database first try to open a telnet connection on dos-prompt to see if there is some firewall block or something like that:

telnet 216.14.120.105 3306

if you don't get an error message and see a blank page then it means you can reach mysql server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM