Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 02-08-2014, 10:12 AM   #1
Senior Member
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,603

Rep: Reputation: Disabled
Error ssh tunneling mysql requests


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: -N me@server
When from the client I try then to issue:
mysql -u root -p -h -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 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 port 3306, connect from port 58118 to port 3307, nchannels 4
I have tried this with localhost instead of with no difference. I also added bind-address = 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.

Old 02-09-2014, 06:48 AM   #2
Registered: Sep 2009
Location: Yorks. W.R. 167397
Distribution: Slackware
Posts: 989
Blog Entries: 4

Rep: Reputation: 1271Reputation: 1271Reputation: 1271Reputation: 1271Reputation: 1271Reputation: 1271Reputation: 1271Reputation: 1271Reputation: 1271
Originally Posted by BCarey View Post
channel 3: open failed: connect failed: Connection refused
The instance of mysql on your server apparently isn't listening on port 3306, you can confirm this by logging in to your server and doing 'netstat -antp'.

This might be something to do with the following lines of /etc/rc.d/rc.mysqld:
# To allow outside connections to the database comment out the next line.
# If you don't need incoming network connections, then leave the line
# uncommented to improve system security.
If none of the above is applicable to your current setup, it might be a firewall issue or something, but we need to eliminate the above circumstances first.
1 members found this post helpful.
Old 02-09-2014, 02:50 PM   #3
Senior Member
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,603

Original Poster
Rep: Reputation: Disabled
Thanks, that fixed it. The daemon was not listening. I had assumed that leaving "skip-networking" commented in my.cnf was enough. Thanks for pointing out that part of the rc.mysqld file.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH server and SSH tunneling Achical Linux - Security 5 05-20-2012 10:07 AM
Cannot connect to remote MySQL server using SSH tunneling nikhil010586 Linux - Server 10 03-18-2009 04:32 PM
Opensource mysql client that supports ssh tunneling pridefc Linux - Software 1 03-08-2008 11:26 PM
LXer: Tunneling MySQL connections through SSH LXer Syndicated Linux News 0 01-02-2007 08:03 PM
SSH Tunneling error... jsheffie Linux - Newbie 3 01-08-2005 05:28 PM

All times are GMT -5. The time now is 08:52 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration