Tuesday, March 15, 2022

[SOLVED] Can't connect to mySQL server - possible reasons?

Issue

After creating 2 security groups and a RDC instance, I am in the terminal and when I tried to connect to mysql using the displayed endpoint with admin password it is giving '110 can not connect'. can you please guide me with possible reason why this is not getting connected? Image of error message is also attached.enter image description here


Solution

It appears that you have:

  • An Amazon RDS MySQL database
  • An Amazon EC2 instance

Assuming that both resources are in the same VPC, the security setup should be:

  • A Security Group on the EC2 instance (EC2-SG) that permits inbound access on port 3389 (RDP) so that you can login to the instance, with Outbound rules set to their default "Allow All" setting
  • A Security Group on the RDS database (DB-SG) that permits inbound access on port 3306 (MySQL) from EC2-SG

That is, DB-SG should directly reference EC2-SG.

When connecting, if it takes several seconds before the connection fails, it is an indication that there is no network connectivity. If it fails immediately, then you have successfully communicated with the RDS database, but it is not permitting your access.



Answered By - John Rotenstein
Answer Checked By - David Marino (WPSolving Volunteer)