0

I have a basic application which writte and read some data from database. A basic mysql connection string is which I'm usually using is:

 MysqlConn = New MySqlConnection
        MysqlConn.ConnectionString = "server=xxxx;userid=xxxx;password=xxxx;database=xxxx;"

When I purchased a new host for my website, I didn't saw that for shared hosting, they provide only mysql connection through ssh tunneling, not remote mysql, so basically, my connectionstring I used is not working anymore.

My question is: Can someone provide code to connect to my database through ssh tunnel?

4
  • What have you tried and what problems dod you have? Did you get any errors that could help?
    – Buurman
    Nov 4, 2015 at 12:06
  • Basically, it gives that it can't connect to mysql server. I asked support from that site (which is namecheap) and they said that for shared hosting, they don't offer remote mysql connection, only ssh tunnel mysql connection. Also I used mysql workbench to edit my databases. I tried with it (without ssh tunnel) and I got same error with can't connect to mysql server. After using ssh tunnel like live chat said, I was able to successfull connect to my database. Nov 4, 2015 at 12:54
  • Possible duplicate of mySQL connection string through SSH tunnel without password Nov 4, 2015 at 13:19
  • it's in C#, I need visual basic code :(, and I'm not so good at converting from C# to VB. Nov 4, 2015 at 16:00

1 Answer 1

0

Use ssh port forwarding.

From Linux or OSX you can do it from the terminal or if you are running Windows use Putty client. Guess you are running Windows if you are developing VB.NET. :)

An example here.

1
  • Well, this app will be used as a marketplace for customers, so I can't ask all my customers to do that ssh port forwarding. That's why I want to integrate this ssh tunnel into my app code. Nov 4, 2015 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.