Accessing your MySQL server over an SSH tunnel
If your server is hosting a website on the Internet and running a database system on the same machine, it is safer to disable remote network access to MySQL. On the other hand, you may still want to manage your databases remotely, and you can do so by tunneling MySQL traffic over an SSH connection.
Note
One of the most important aspects of a database system is the speed with which it can find and return the data that you ask for. Tunneling traffic over SSH will add significant overhead to this communication. This solution is great for intermittent management tasks, but is typically not suitable as a replacement for a direct connection to your database system.
Getting ready
The server you want to connect to must run both the MySQL server and an SSH server. The remote client machine must have an SSH client and MySQL client software installed. Make a note of the IP address or domain name of the server (mysql-host
), the SSH username (ssh-user
), MySQL...