I am having trouble connecting to my RDS instance from my EC2 instance. I added the elastic IP address for the EC2 instance to the RDS security group. as follows: xx.xxx.xx/32
I am using a PHP script to test the connection.
I added my local IP address to the RDS security group as follows: xx.xxx.xx/32, and using the same script (running locally on my MAC),I can connect to it from my local PC ().
Here's the script I'm using to test:
<?php
$db_host = 'xxxxxxxxxx'; //this is the RDS endpoint, not the IP address
$db_user = 'xxxxxx';
$db_password = 'xxxxxx';
$db_name = 'xxxxxxx';
$mysqli = new mysqli($db_host, $db_user, $db_password, $db_name);
echo 'Server Info = '.$mysqli->server_info.'<br />';
echo 'Server Version = '.$mysqli->server_version.'<br />';
echo 'Connect Error = '.$mysqli->connect_error.'<br />';
?>
When I run it from my EC2 instance, I get the following:
Server Info =
Server Version =
Connect Error = Unknown MySQL server host 'xxxxxxxx' (20)
When I run it from my local machine (Mac), I get the following:
Server Info = 5.5.27-log
Server Version = 50527
Connect Error =
Any ideas?