connecting to MySQL database thru SSH tunnel

Bernard Devlin bdrunrev at gmail.com
Thu Dec 8 17:02:45 CST 2011


Are you sure that your tunnel is working?

I'm assuming that for some reason SSL is not an option, neither is a VPN.
You should be able to tunnel a database connection through a SSH tunnel.
I've done it many times with different kinds of databases and servers
(although never with MySQL).

Can you provide the SSH command-line options you are using to create your
tunnel? As far as Livecode would be concerned, it would be connecting to a
MySQL server running on your local machine, so it's likely the problem lies
in the tunnel not being created.  In fact, if you don't have MySQL
installed/running locally, then you should be able to just assign the
normal MySQL port to the local end of your tunnel (port 3306 is the default
I believe).  That way you would obviate the need to change ports (so you'd
be specifying 3306 as the local end of your tunnel).

You could try using telnet to connect to localhost:3306 to see if there is
a response from MySQL through the tunnel (telnet localhost 3306).  If you
do that before you have the tunnel created, then you'll find out if MySQL
is already running on your computer.

When you create your tunnel, you can make SSH give you wads of information,
by specifying the -v option (increase the verbosity by incrementing the
number of Vs e.g. -vvv).

If you can verify the tunnel is working using telnet, then it would seem to
be something peculiar to MySQL (or a local configuration problem with OS X).

Bernard

On Wed, Dec 7, 2011 at 10:08 PM, Sieg Lindstrom <sl at trackandfieldnews.com>wrote:

> That doesn¹t work. I get the following error message.
>
> ³Can¹t connect to local MySQL server through socket Œtmp/mysql.sock¹ ²
>
>


More information about the use-livecode mailing list