1
votes

I am getting Error establishing a database connection while trying to connect to mysql on Amazon RDS from my Wordpress instance.

Wordpress is on my AWS Linux EC2 Instance, both are on the same VPC, same Security Group allowing 3306 inbound rule, db credentials in wp-config is also correct.

I am able to connect to my mysql RDS instance while ssh with the following command and it connects fine:

mysql -h "endpoint url" -u "username" -p "password";

However, when accessing the EC2 EIP on the browser to setup my WP final configuration I get the error connecting DB.

1
Can you post full error message? Maybe wb logs have more details?Marcin
To clarify... Are you saying that you can connect from the Amazon EC2 instance to the Amazon RDS instance by using the above mysql command, but WordPress (on the same EC2 instance) is unable to connect to RDS? If so, the problem is clearly not related to networking. It would likely be a configuration issue (URL, username, password). Hopefully you'll find a helpful message in one of the WordPress logs.John Rotenstein

1 Answers

1
votes

Did you check your security group? Because you have to open the MySQL Port 3306.

When you are creating the RDS, it is important to create a new security group, like myRDSgroup, later you have to modify it by open the port 3306 in the source select the security group where your AWS EC2 is located.

Could you send your security group screenshot, please?