0

I am trying to connect to RDS from my localhost and ec2 server.
I can connect fine with MySQL Workbench 5.2 CE but i cant seem to connect with PHP.
They are in the same zone and security group.

$dbName = "*******-****.***************.**-****-*.rds.amazonaws.com:3306";
$dbTable = "myTable";
$dbUser = "myUser";
$dbPass = "*********";

define("HOST", $dbName);
define("DBUSER", $dbUser);
define("PASS", $dbPass);
define("DB", $dbTable);
$conn = new mysqli(HOST, DBUSER, PASS, DB) or  die();

these are the errors
Warning: mysqli::mysqli() [<a href='mysqli.mysqli'>mysqli.mysqli</a>]: php_network_getaddresses: getaddrinfo failed: No such host is known.

Warning: mysqli::mysqli() [<a href='mysqli.mysqli'>mysqli.mysqli</a>]: [2002] php_network_getaddresses: getaddrinfo failed: No such host is known. (trying to connect via tcp://*******-****.***************.**-****-*.rds.amazonaws.com:3306)

Warning: mysqli::mysqli() [<a href='mysqli.mysqli'>mysqli.mysqli</a>]: (HY000/2002): php_network_getaddresses: getaddrinfo failed: No such host is known.

the endpoint works fine as i said with the client, not on browser.
but what does this error mean, and how would i start debugging this?

4

1 回答 1

1

您是否在亚马逊管理控制台中检查了您的亚马逊 ec2 的安全组。请检查您是否打开了 mysql 的端口(即 3306)

于 2012-12-03T04:46:55.313 回答