Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Connecting to a local database on a remote machine (See related posts)

I had a MySQL instance on a remote server that had only local access. I wanted to connect to that database via my local copy of CocoaMysql. Using ssh portforwarding you can do it like this:

ssh -N -L <port_number>:127.0.0.1:3306 remote_machine


so you can now open CocoaMysql and connect to localhost, bla, bla but if you use the <port_number> assigned above you should see your remote database.

You need to create an account or log in to post comments to this site.


Click here to browse all 5141 code snippets

Related Posts