Le Nguyen The Dat bio photo

Le Nguyen The Dat

~ Data Science & Engineering

Twitter Facebook LinkedIn Github
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 -NT
    • mysql -h -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: -R 29001: -L 3307:localhost:3306 -NT port-forwarding-user@my.host.com"
  • mysql -h -P 3307 -u root -P