mysqlamazon-web-servicesremote-access

Connect to MySQL on AWS from local machine


I am trying to set up a dev environment on my local machine that accesses a MySQL DB on AWS, but I keep getting a "Can't connect" message.

mysql_connect('xxx.xxx.xxx.xxx:3306', 'USERNAME', 'PASSWORD');

I also commented out the bind-address in the my.cnf file, and granted permissions to the IP address that is connecting.

Anyone ever successfully get this working?


Solution

  • I suppose this is firewalled by Amazon, try using a SSH tunnel:

    http://blogs.oracle.com/divyen/entry/connecting_mysql_server_on_amazon

    Note: Do not open MySQL to the public internet, not even when using IP filtering. SSH tunnels are way more secure. Best part of it: The tunnel could be accessible with localhost:3306 on your machine, no need to change the config : )