views:

81

answers:

1

I have developed a web application that uses PHP and MySQL and has all been running fine from a single development server. I now want to separate things a bit and place an app server within Amazons cloud that will receive and process uploaded files. The database is going to remain on the dedicated server but will need to be accessed by the EC2 instance.

Heres what I have tried so far...

In phpMyAdmin I added a new user to the privileges table. I gave it the elastic IP address from AWS as the host name, a new password and granted privileges to INSERT, SELECT and UPDATE.

In the PHP scripts on my EC2 based app server I included this username, password and the domain name of the location of the mysql server (example.domain.net) when connecting with mysql_connect

I have a simple test page that tries to SELECT and echo some results from the database but get the following error -

Could not connect to MySQL: Can't connect to MySQL server on 'example.domain.net' (4)

What could this mean, what have I missed, are there any other issues such as trying to do this from within EC2 that will cause other problems?

cheers all

A: 

Turns out the only other thing I needed to do was to open port 3306 on the database server to allow access. Did this by going to Control Panel -> Windows Firewall -> Exceptions -> Add Port ["SQL", 3306]

Now it works great!

undefined