Connecting to remote mysql VS2022

SteveWin

New member
Joined
Nov 1, 2022
Messages
4
Programming Experience
1-3
Hi All,

I'm fairly new to C# and Winforms development. I have successfully set up my app Winform application which uses an instance of MySQL running on a dedicated box on my LAN. I am using the Mysql.Data Nuget. It all works fine.

Here is my question.

What I want to do is access a mysql database on my hosted account (Dreamhost). However, Dreamhost insist on using SSH tunneling. There is no problem accessing it via Workbench since it has SSH access built in but does anyone know the best (and simplest) way of doing it in VS2022 using the MySQL.Data nuget (or another nuget package if necessary). Alternatively, can anyone recommend a host for MySQL that doesn't require SSH?

Grateful for any help or advice.
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
6,066
Location
Chesapeake, VA
Programming Experience
10+
Exposing any database naked to the Internet is an invitation to have your data hacked. You're databases should stay nicely behind a firewall and the only thing exposed out the Internet should be web services which performs specific operations on the database with the least privileges needed for those operations.
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
6,066
Location
Chesapeake, VA
Programming Experience
10+
But it's your data, if you think the convenience is worth the risk, have at it:
 

SteveWin

New member
Joined
Nov 1, 2022
Messages
4
Programming Experience
1-3
None of these are any use (it was about accessing hosted MySQL through SSH tunneling) but thanks for trying. It was just test data for demo so security is no big deal at the moment.
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
6,066
Location
Chesapeake, VA
Programming Experience
10+
Basically most of the solutions you'll find will require you to use some kind of SSH library. You'll connect to SSH using that library, and then tell the library to do port forwarding. Once the port forwarding has been established, you would connect to localhost:3306.
 
Top Bottom