Just some notes for myself:
Apparently SSH Tunnelling works better than SSL for secure connection with MySQL server...AutoSSH is to keep SSH session always alive (apt-get install autossh)Command to be used:autossh -M29001 -f user@my.host.com -L 3307:localhost:3306 -NTmysql -h 127.0.0.1 -P 3307 -u root -P
Scratch all that. For some reasons, the performance while using Autossh with MySQL is just terrible . I'm not sure what the exact problem is, if it is from Autossh or MySQL, but I do know they don't go well together in my case.
As a work-around, just put this alias on your ~/.bashrc and re-run it everytime it goes down (very rarely unless you do something at the server.)
- alias mysqltunnel="ssh -f -L 29001:127.0.0.1:29001 -R 29001:127.0.0.1:29002 -L 3307:localhost:3306 -NT port-forwarding-user@my.host.com"
- mysql -h 127.0.0.1 -P 3307 -u root -P