Make a remote port available locally with an SSH tunnel
ssh tunnel to remote mysql | ssh local port forwarding example | access remote database through ssh | ssh | tunnel | port-forwardingssh -N -L 3307:127.0.0.1:3306 webuser@server.example.comForwards connections to 127.0.0.1:3307 on your own machine, encrypted, to port 3306 on the server. This lets you work on a database with a local client without exposing the port to the internet. -N only sets up the tunnel without opening a shell, stop it with Ctrl+C.
Note: The client must explicitly use 127.0.0.1 instead of localhost, otherwise MySQL tries a socket connection.
Also searched as
- ssh tunnel to remote mysql
- ssh local port forwarding example
- access remote database through ssh