Connecting To My SQL

If you are trying to connect to your database from a physically separate application server, see Communications Within The Cluster

To access your mysql database remotely- i.e. from anything but a shell on your server- you’ll need to tunnel traffic via ssh. In Linux or Mac OS X this is accomplished easily:

ssh -L 8888:localhost:3306 deploy@your-account.railsmachina.com

This will setup a tunnel from port 8888 on your local machine to port 3306 (the default mysql port) on your server. You can then connect to mysql using ‘localhost’ as the host and ‘8888’ as the port. Using the command line client:

mysql --user database_user --password --port 8888 --protocol=TCP database_name

On Windows, you can create tunnels using putty or with ssh in cygwin.

Meta