简体   繁体   English

如何将 MySql 在线数据库连接到 C# 桌面应用程序

[英]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.我正在用 c# 创建桌面应用程序,但我不会使用在 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.如果这是本地服务器用户“localhost”中的 MySQL 数据库,用于服务器 IP,如 georgi-它也告诉。 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:但是如果这是一个外部数据库,首先尝试在 dos-prompt 上打开一个 telnet 连接,看看是否有一些防火墙阻止或类似的东西:

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如果您没有收到错误消息并看到空白页面,则表示您可以访问 mysql 服务器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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