» Quick Links
You can make money on these forums
We Share profits with you
Google
Google Adsense
Google Adwords
YPN
Yahoo
MSN Search
Web Directories
Web Hosting
Web Hosting Offers
Hosting News
Suggestions
Link Building
Domain Names
PHP Forums
MySQL Forums
» More Links
OSP News
Reseller Hosting
Shared Hosting
Dedicated Servers
Google Adsense
Search Engine Marketing
Link Development
Affiliate Marketing


» Advertising
Multiple DC PR Check

Free SEO Tools


Go Back   Webmaster Forums > Website Developement / Programming > MySQL Forums

MySQL Forums Share Your Ideas and Tips about MYSQL. Ask questions about MYSQL. Table Design and Much More...

Reply
 
Thread Tools Display Modes
  #1  
Old 02-16-2007, 05:02 AM
Fabiola Fabiola is offline
Junior Member
 
Join Date: Aug 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Fabiola is on a distinguished road
Default connection over ssh tunnel???

Hello guys,
Running 4.1.11 on FC4, i wana connect to it remotely via an ssh tunnel. Logging on locally, all works fine i.e. mysql -h localhost -p gets me in.

I setup my ssh tunnel from on another box:
remotebox# ssh -N -L3306:localhost:3306 root@mysqlserver.somewhere.com

I get the following error:
remotebox@root:~$# mysql -h localhost -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Things i've done:
moved socket=/var/lib/mysql/mysql.sock to socket=/tmp/sock for both server and client in my.cnf, on both systems.

This is how mysqld is started
/bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/my.cnf --pid-file=/var/run/mysqld/mysqld.pid
/usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysq -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Revenue Sharing Ads ( ?):
  #2  
Old 02-16-2007, 08:29 AM
rian rian is offline
Senior Member
 
Join Date: Jul 2006
Posts: 135
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 18
rian is on a distinguished road
Default

Try to make a telnet localhost 3306 to see what's going on. Then check that you don't have another copy of MySQL local, using the same port, in that case you can make an ssh tunnel to the remote server, opening a new local port eg. 3030:

SSH TUNNEL:

nohup ssh -l root -a -g -N -x -T -L 3030:REMOTESERVERIP:3306 REMOTESERVERIP &

Make sure you have a rule in the remote server iptables to allow REMOTESERVERIP to connect to that MySQL locally, eg.

IPTABLES RULE:

-A INPUT -s REMOTESERVERIP -p tcp -m tcp --dport 3306 -j ACCEPT

The applications running MySQL must use the port 3030 instead of 3306. -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hurricane Electric Upgrades Connection at PAIX outsourcingplans Web Hosting News 0 12-12-2006 03:54 AM
default connection....?? Junior MySQL Forums 1 08-19-2006 05:32 AM
Ask PHP about mySQL existing connection? climax PHP Programming and Tips 2 08-17-2006 02:53 PM
need a cheap and stable connection. Jammie Web Hosting Industry 1 08-08-2006 04:58 AM
set mysql connection limit for each account bryan Web Hosting Industry 1 03-29-2006 02:25 PM


All times are GMT. The time now is 10:52 PM.