Allow remote MySQL connections to an AWS Instance

Mar 1, 2011 by     No Comments    Posted under: Amazon AWS, Tech

This took a while to figure out, but it’ll be easy for you if you follow the steps below:

1. Install the EC2 API Tools (setup instructions for Mac OS X)

2. SSH into the instance in which you wish to allow remote MySQL connections, and edit the my.cnf file. In Ubuntu, you can find this at

/etc/mysql/my.cnf

Look for the line that starts with bind-address, and comment it out. If enabled, this line tells the MySQL server to only allow connections from the localhost.

3. Login to your EC2 instance at Amazon AWS. Make a note of the security group that your instance belongs to. In my case, it was “default.”

4. Back on your machine where you installed the EC2 API Tools, run the following command:

ec2-authorize default -p 3306

* Note if your MySQL port is something other than 3306, change the above command to the appropriate number.

That’s it! You should be connecting now with no problems.