Thursday, February 2, 2012

tunneling using SSH and connect via MySQL in different port

I use the command below with -f [requests ssh to run in the background], and -N [to not execute a remote command]

$> ssh -L -p 2222 -f -N

the -L argument specifies that 3307 is the port to be used locally from [the remote server] on its 3306 port [MySQL default port].

Then run the command below to connect to MySQL with port 3007.

$> mysql --host= --port=3307 --protocol=TCP -u mysqluser -p

Hope this helps.

No comments: