[SOLVED] Cant connect to mysql server on AWS RDS

Issue

This Content is from Stack Overflow. Question asked by nbz

I’ve set up a basic AWS RDS in the free tier. No public access but created a security group with my IP address added as an inbound rule.

For authentication I have RDS password plus AWS IAM.

I try to connect to the db via my computer (Ubuntu) with the following command:

mysql -h <db-conn>.amazonaws.com -P 3306 -u admin -p

I’ve already looked at this answer – Cant connect to mysql server on AWS RDS My port isn’t blocked and I’ve checked the security group. I am able to successfully run AWS CLI commands like this:

aws rds describe-db-instances --filters "Name=engine,Values=mysql" --query "*[].[DBInstanceIdentifier,Endpoint.Address,Endpoint.Port,MasterUsername]"

But every time I run the mysql command, I get the following error:

ERROR 2002 (HY000): Can't connect to MySQL server on '<db-conn>.amazonaws.com' (115)

Would love some assistance with this. Thanks!



Solution

RDS has a security group – in the AWS console, RDS, there’s an entry for security groups.

If you didn’t explicitly create a security group, you are probably using “default”. You should probably have one group per RDS instance.

You will need to make sure that port 3306 is open to your local network, as well as whatever application you will be using to connect to it. You can allow access by IP or by security group.


This Question was asked in StackOverflow by Rajaraman and Answered by chris It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?