Secure MySQL connections

Opinion
Jun 6, 20052 mins

We want to connect a desktop database client from a Windows PC directly to a MySQL database server. The server is configured to only accept connections from a specified Web server that uses a shell account that logs on via SSH. What can we do?

We want to connect a desktop database client from a Windows PC directly to a MySQL database server. The server is configured to only accept connections from a specified Web server that uses a shell account that logs on via Secure Shell (SSH). What can we do?

With SSH port forwarding you can connect directly to the database server by tunneling through your shell account on the Web server. You can even read and write the database tables using Microsoft Access and the MyODBC connector from www.mysql.com through the SSH tunnel.

To establish an SSH tunnel with a command line SSH client, type:

ssh -l loginID -L 3306:mysqlhost:3306 shellhost

.

This logs into the shell account host as loginID, while connecting local Port 3306 on your desktop to the mysql host at Port 3306 through the SSH connection via the shell host.

Most graphical SSH clients let you establish tunnels through configuration or preference options, so look for the Tunnel or Port Forwarding settings and establish the same kind of connections. After you establish connections the first time, make sure the tunnel is set up and connected before you talk to the database server.