mysql tunnel
When I start the script I get
ssh: connect to host domain.com port 22:Connection refused
since I am not using port 22 to ssh, the tunnel script gives me error. How can I fix this? Where and how can I add the port number I am using to the script?
I tried
$remote_host = "domain.com:2222";
that didnt work.
??
thank you
11 Replies
system "ssh -f -L $localip:$localport:$remoteip:$remoteport $remoteuser\@$remotehost -N";
to system "ssh -p
(Why'd you change the default ssh port, btw? It doesn't make you any more insecure. Infact, making it port >1024 makes you slightly less secure)
However, I cant access it on localhost:3306, I wonder what I am missing.
When I go to localhost:3306 on the browser, on the terminal I get "channel 1: open failed: connect failed: Connection refused"
any ideas how I can resolve this issue ???
I am using a different port number, in order to make it more secure. I am not using 1024. I wonder why 1024 is less secure compare to other ports.
thank you.
@superdupler:
I wonder why 1024 is less secure compare to other ports.
Not just 1024, any port greater than 1024. Ports below 1024 require root privileges to access them, so are more difficult to screw around with.
@superdupler:
When I go to localhost:3306 on the browser, on the terminal I get "channel 1: open failed: connect failed: Connection refused"
Sound like you might still need to configure MySQL to listen on localhost. In the [mysqld] section of /etc/mysql/my.cnf, comment out the 'skip-networking' line and add a line that says bind-address = 127.0.0.1
cd /etc/mysql/my.cnf
bind-address = 127.0.01
happened to Debian
I checked my local mysql on the firefox browser localhost:3306. The browser stated "Got Packets out of order". In any case, I launched mysql query browser. I was able to see the database, and tables without a problem.
Then, I used the mysql-tunnel.pl from the instructions.
On the terminal I got a message.
> bind: Address already in use
channelsetupfwd_listener: cannot listen to port: 3306
Could not request local forwarding.
Then, I tried again by changing the $localport = "3306"; to $localport = "3307"; on mysql-tunnel.pl. Then, I got
> channel 1: open failed: connect failed: Connection refused
???
@superdupler:
On the terminal I got a message.
> bind:Address already in use channelsetupfwd_listener: cannot listen to port: 3306
Could not request local forwarding.
You have something already running. Kill it first.
> Could not connect to host '127.0.0.1'.
MySQL Error Nr. 2013
Lost connection to MySQL server at 'reading initial communication packet', system error:0
Click the 'Ping' button to see if there is a networking problem
on the terminal
> channel 1: open failed: connect failed: Connection refused
???
On my remote server, the my.cnf bind address isnt 127.0.0.1, nor localhost. It is a local network address (192.168.166.9)
So, I decided to change my.cnf on my local computer bind address from 127.0.0.1 to the same local network address of the remote server. 192.168.166.9
then I did
ssh -p 2222 -v -f -N -L 3307:192.168.166.9:3306 user@serverip
Then, try to use mysql query browser, I get similar errors
MySQL Error Nr. 2003
I think my iptables are set correct.
I even tried to connect by using the connections here. I get the same errors.
how can I solve this issue?
changed bind address=0.0.0.0
some progress, but still get errors.
on the query browser…
> Could not connect to host '127.0.0.1'.
MySQL Error Nr. 1130
Host '192.168.166.9' is not allowed to connect to this MySQL server
on the terminal
> Connection to port 3307 forwarding to 192.168.166.9 port 3306 requested.
debug1: channel 2: new [direct-tcpip]
debug1: Connection to port 3307 forwarding to 192.168.166.9 port 3306 requested.
debug1: channel 3: new [direct-tcpip]
debug1: channel 2: free: direct-tcpip: listening port 3307 for 192.168.166.9 port 3306, connect from 127.0.0.1 port 58429, nchannels 4
debug1: channel 3: free: direct-tcpip: listening port 3307 for 192.168.166.9 port 3306, connect from 127.0.0.1 port 58430, nchannels 3