MySQL connection over SSH tunnel – how to specify other MySQL server?

Solved it! The thing was to connect to the correct server when creating the tunnel itself – should’ve seen that one coming.

ssh -f [email protected] -L 3307:mysql1.example.com:3306 -N

Then mysql -h 127.0.0.1 -P 3307 worked as intended. 🙂

Leave a Comment