Create an SSH Tunnel for MySQL Remote Access
To create a SSH tunnel that listens on port 3307 on localhost and
connects to port 3306 (MySQL) on
ssh -fNL 3307:127.0.0.1:3306 \ firstname.lastname@example.org
If successful you can login to MySQL running on the remote host by executing on localhost:
mysql -h 127.0.0.1 -P 3307 \ -u USER -p DATABASE
This also works with applications like MySQL Workbench.