Benefit of SSH Tunneling
Many hosting companies that provide MySQL hosting block access to the MySQL server from outside the hosting company's network and grant access only to users connecting from localhost
or from a machine within the network
. The major benefit of SSH tunneling is that it allows you to connect to a MySQL server from behind a firewall when the MySQL server port is blocked (see Figure 3
). As long as the hosting company provides SSH access, you can still connect through SQLyog's SSH Tunneling option.
Setting Up SQLyog for SSH Tunneling
Select the Tunnel tab in the connection window (see Figure 4) and provide the information listed in Table 1.
||Username to access the SSH server
||Password to access the SSH server
||Address of the machine on which SSH server is running
||Port on which SSH server is listening (22 by default)
||Value always is localhost and read-only, because SQLyog creates the SSH port forwarding option on the local machine only
||Port on which SQLyog will listen locally for correctly port forwarding MySQL requests. (Note: If you are connecting to two (or more) MySQL servers, then you need to provide two different local port values in the respective connections.)
|Table 1. SSH Connection Settings Information|
To understand the setup better, connect to a MySQL server using the following real life example:
- Your Web site is hosted on the Web server 220.127.116.11, which also hosts a SSH server that runs and listens on port 22.
- Your MySQL server is located on server 18.104.22.168, and it allows connections only from localhost or another machine within the same network (i.e., 22.214.171.124).
- You publish your Web site on 126.96.36.199 using the username and password your ISP provides (for this example, the username and password are ssh_user and ssh_pwd, respectively).
To complete the setup for this example, you have to input the following values for various server and tunnel options:
|MySQL Host Address
||Your mysql user name
||Your mysql password
||The database that you want to connect to (You can leave this field blank.)
||The port MySQL is listening (3306 by default)
||Any port that is unused on your local machine (If you don't have a MySQL running on your machine, you can provide 3306.)
Press Connect to log into your server, and you can then use SQLyog and SSH tunneling to securely and efficiently manage your MySQL database.
Secure Connectivity with SQLyog
SQLyog gives you a choice of connectivity options. No matter what your firewall/proxy/ISP settings are, you should be able to use it to smartly manage your MySQL server(s).