I created my MySQL 5.7 database with RDS.
Before, I connected with PDO to a database on the same server as the web server. Server that is not an EC2. All worked well.
I create my RDS database and modify my class for the DB with the AWS id and now, it doesn't work any more.
The connection information seems correct because I can connect to it from MySQL Workbench.
Here is my code:
$_HOST = 'xxxxxxxxx.us-east-2.rds.amazonaws.com';
$_PORT = 3306;
$_DBNAME = 'xxxxx';
$_USER = 'xxxx';
$_PASS = 'xxxx';
$connexionString = "mysql:host={$_HOST};port={$_PORT};dbname={$_DBNAME}";
self::$_instance = new PDO($connexionString, $_USER, $_PASS);
And here is the error message:
PDOException: SQLSTATE[HY000] [2002] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
What do you think is going on?