LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


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

Rep: Reputation: Disabled
Error ssh tunneling mysql requests


Hi,

So I'm trying to use an ssh tunnel to access a remote mysql server. I'm using the following ssh command:

Code:
ssh -vv -L 3307:127.0.0.1:3306 -N me@server
When from the client I try then to issue:
Code:
mysql -u root -p -h 127.0.0.1 -P 3307
I get the following result:
Code:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0
while ssh reports:
Code:
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.

Brian
 
Old 02-09-2014, 06:48 AM   #2
55020
Senior Member
 
Registered: Sep 2009
Location: Yorks. W.R. 167397
Distribution: Slackware
Posts: 1,307
Blog Entries: 4

Rep: Reputation: Disabled
Quote:
Originally Posted by BCarey View Post
[code]
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:
Code:
# 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.
SKIP="--skip-networking"
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
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,639

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.

Brian
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:54 AM.

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