List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:February 27 2002 2:40am
Subject:Re: difficulty using mysql with ssh tunneling
View as plain text  
At 18:20 -0800 2/26/02, David M. Goodstein wrote:
>I've set up an ssh tunnel between my local machine and a remote host
>("Fred") as follows:
>    ssh daveg@fred -L 3306:localhost:3306
>in an effort to access a remote mysql database running on fred.  I've
>verified that the tunnel is working by telnetting into fred 3306 and
>seeing the mysql version info from the remote solaris system.
>If I now enter:
>     mysql --host=localhost  -udavid -ppassword  (david and password are
>the mysql username and password), i get the following:
>ERROR 2002: Can't connect to local MySQL server through socket
>'/var/lib/mysql/mysql.sock' (2)
>So, for some reason, mysql is "convinced" i'm running a local  mysqld
>and is trying to hook up to it.  Of course there's no local daemon
>running, so it chokes when it can't find the socket.  Is there any
>reason it is not simply reaching out to port 3306 locally and thus
>finding the tunnel?

The name "localhost" is special to MySQL, which always interprets it
as meaning "use a UNIX socket".  Try instead.

>--David Goodstein

difficulty using mysql with ssh tunnelingDavid M. Goodstein27 Feb
  • Re: difficulty using mysql with ssh tunnelingPaul DuBois27 Feb