Ssh – Access remote thesql server over ssh tunnel

MySQLsshssh-tunnel

I'm having trouble accessing a remote mysql server (that is set to skip-networking/no remote connections). I've been able to successfully create a ssh tunnel, but how can I access the server's mysql socket over that tunnel?

Best Answer

You'll need to have some kind of IP method to access that mysql server remotely, using only sockets will give you access to that mysql server from the local machine.

Your best option here would be activating networking but firewalling the mysql server so it's only accessible from localhost, then once you get your tunnel working it should be fairly straightforward to connect remotely through the ssh tunnel either directly from the command line ssh -L 3306:localhost:3306 user@server or using .ssh/config LocalForward 3306 localhost:3306

Related Topic