Accessing MySQL on AWS hosted Bitnami stack

I’ve been using AWS (Amazon Webservices) now for a while for a number of my websites. I generally use the Bitnami AMI as I find these easy to set up and have all of the tools already installed.

One question I sometimes get asked is, how do I access the MySQL database (via MySQL workbench) from a remote computer (generally a Mac or Unix based system).

To do this you will need a SSH client. I’m going to assume you have one already installed on your system. You will also need your key (pem) file that you would have gotten when you setup your virtual machine

ssh -L3406:localhost:3306 -i my-key-file.pem bitnami@<your ip>

Just replace the values above with the name of your .pem file and your IP address or hostname

I’ve just a forwarding port of 3406 so that it doesn’t clash with my actual locally running MySQL instance.

Then from your MySQL client (workbench/administrator etc) you should be able to log in with the required credentials. You will need to use “localhost” (without the quotes) as the hostname and the port 3406 rather than the default 3306. The SSH (encrypted) tunnel will forward all data to the MySQL database on your AWS instance.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.