So I'm trying to use an ssh tunnel to access a remote mysql server. I'm using the following ssh command:
ssh -vv -L 3307:127.0.0.1:3306 -N me@server
When from the client I try then to issue:
mysql -u root -p -h 127.0.0.1 -P 3307
I get the following result:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
while ssh reports:
debug1: Connection to port 3307 forwarding to 127.0.0.1 port 3306 requested.
debug2: fd 9 setting TCP_NODELAY
debug2: fd 9 setting O_NONBLOCK
debug1: channel 3: new [direct-tcpip]
channel 3: open failed: connect failed: Connection refused
debug2: channel 3: zombie
debug2: channel 3: garbage collecting
debug1: channel 3: free: direct-tcpip: listening port 3307 for 127.0.0.1 port 3306, connect from 127.0.0.1 port 58118 to 127.0.0.1 port 3307, nchannels 4
I have tried this with localhost instead of 127.0.0.1 with no difference. I also added bind-address = 127.0.0.1 to /etc/my.cnf per some advice I found and do not have skip-networking enabled.
I am able to tunnel a vnc session using the same client and server boxes, so I know ssh is basically working well. I think the problem is with mysql but I'm not sure.
Thanks in advance for any help.