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 username@example.com -L 3307:example.com:3306 -p 2222 -f -N

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



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

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

Hope this helps.

Comments

Popular posts from this blog

Using Oracle 11g thru VirtualBox appliance in Mac OS X Lion

Use Shell Editor for Eclipse for editing bash, ksh, csh in Unix/Linux system

LVM: How to remove a volume using pvremove