Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8013981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:47:34+00:00 2026-06-04T19:47:34+00:00

I want to connect trough SSH channel to mysql database on the server. I

  • 0

I want to connect trough SSH channel to mysql database on the server.

I have downloaded this SSH.Net library.

This is what I have tried and I thought it will work after my secured connection has been established.

My SSH connection is established but normal connection to database is not executed.

So check my code please:

using (var client = new SshClient("cpanel****", "******", "******"))
          {
            client.Connect();
            con = new MySqlConnection(GetConnectionString());
            con.Open();
            cmd = new MySqlCommand(String.Format("insert into {0} values (null, ?Parname , ?Parname2, ?Parname3, ?Parname4, ?Parname5, ?Parname6, ?Parname7);", ConfigSettings.ReadSetting("main")), con);
            cmd.Parameters.Add("?Parname", MySqlDbType.Double).Value = Math.Round(deciLat, 5);
            // ... more parameters
            cmd.ExecuteNonQuery();
            client.Disconnect();
           }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:47:37+00:00Added an answer on June 4, 2026 at 7:47 pm

    Here is a tutorial http://georgelantz.com/2007/09/10/access-mysql-through-ssh-tunnel-in-a-windows-net-application/ which sounds reasonable.

    Basic idea is to establish an SSH connection with a tunnel (aka port forwarding) and then point your MySQL connection to localhost.

    SSH tunnel redirects connections to localhost:XX to the ssh server port:YY. So your port YY will be the mysql connection port, and in your connection string you would use localhost:XX.

    The SSH library you are using also seems to support port forwarding, so you might be able to get that working as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So the scenario is this: I have a mySQL database on a local server
I have a big SQL Server database I want to connect to and my
I want to connect to a URL with the socket method ( http://msdn.microsoft.com/en-us/library/system.net.sockets.socket(v=VS.96).aspx );
currently I'm working on this ftp transfer. http://msdn.microsoft.com/en-us/library/ms229715.aspx I have setup my server computers
I want to connect to a MySQL database that is installed on a linux
I want to connect to my remote MySQL server through port forwarding. Unfortunately my
I want to connect to a remote database (SQL Server 2008) through code using
How do I write code to connect through Windows VPN client? I want this
I want to connect from home using SQL Server 2005 to another PC. I
I want to connect to DB2 from excel macro...This is my code, but it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.