如何在C#中建立与远程Mysl数据库的安全连接 [英] How Do I Mek A Secure Connection To A Remote Mysl Databse In C#

查看:119
本文介绍了如何在C#中建立与远程Mysl数据库的安全连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好evryone。我有一个ac#windows应用程序连接到本地mysql服务器上的mysql数据库,连接如下。

  void  connectDB()
{
string connectionString;
connectionString = SERVER = localhost; DATABASE = mydatabase; UID = root; PASSWORD = mypassword;;
connection = new MySqlConnection(connectionString);
connection.Open();
connection.Close();
}



i希望用远程mysql服务器托管的数据库运行这个应用程序,并说另一台计算机。



我现在的问题是,如何使用ac#windows应用程序从另一台计算机建立到远程mysql服务器的安全连接?



任意帮助的形式将不胜感激。

解决方案

这是一个明显的答案:

更改SERVER = localhost;



SERVER = remotehostname; //服务器的DNS名称



SERVER = 100.10.10.10; //服务器的IP地址



不完全确定安全连接是什么意思。



查看此页面以获取有关MySQL连接字符串的更多信息。

http:// www。 connectionstrings.com/mysql/ [ ^ ]

Hello evryone. I have a c# windows application connecting to a mysql database on a local mysql server with the following connection.

void connectDB()
{
    string connectionString;
    connectionString = "SERVER= localhost; DATABASE=  mydatabase ; UID=  root ; PASSWORD= mypassword ;";
    connection = new MySqlConnection (connectionString);
    connection.Open();
    connection.Close();
}


i want to run this application with the database hosted on a remote mysql server say from another computer.

My question now is, "how can i establish a secure connection to a remote mysql server from another computer using a c# windows application?"

Any form of help would be appreciated.

解决方案

This is the obvious answer:
Change the SERVER= localhost;
to
SERVER= remotehostname; // The DNS name of the server
or
SERVER= 100.10.10.10; // The IP address of the server

Not exactly sure what you mean by "secure connection", though.

Look at this page for more info about connection strings for MySQL.
http://www.connectionstrings.com/mysql/[^]


这篇关于如何在C#中建立与远程Mysl数据库的安全连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆