 |
|
ผมได้ทำการเชื่อมต่อฐานข้อมูล Mysql แต่ต้องผ่าน Ssh แต่ขึ้นข้อความดังรูปด้านล่างครับ ผมลอง debug code ในส่วน ssh connect ผ่านปกติครับ
ssh ip , port , username .password ผมลองทดสอบแล้วเข้าได้ครับ
mysql ip,port,username,password ผมลองทดสอบเข้าได้ปกติครับ
ไม่แน่ใจว่าต้องปรับตรงส่วนไหนครับCode (C#)

Code (C#)
using (SshClient client = new SshClient("hostSsh", "usernameSsh", "passwordSsh"))
{
//var port = new ForwardedPortLocal(3306, "localhost", 3306);
//client.AddForwardedPort(port);
client.Connect();
MySqlConnection connection = new MySqlConnection(
"server=localhost; port:3306; database=mysqldb; uid=Mysqlusername; Password =Mysqlpassword"
);
connection.Open();
connection.Close();
client.Disconnect();
}
Tag : .NET, MySQL, C#, Linux
|
|
 |
 |
 |
 |
Date :
2014-10-10 17:36:38 |
By :
joeycole |
View :
1426 |
Reply :
7 |
|
 |
 |
 |
 |
|
|
|
 |