Cannot connect to mysql server on AWS RDS

I am new to AWS RDS. I created an instance of RDS. But I do not know how I can connect this database. I tried like this

mysql -h awsinstanamehere.rds.amazonaws.com -P 3306 -u username -p 

After I entered the password and I get some error like this

ERROR 2003 (HY000): unable to connect to MySQL server on 'awsinstanamehere.rds.amazonaws.com' (110)

Need to set any security setting in the AWS console?

Note: I want to import tables for this DB

thanks

+6
source share
4 answers

RDS has a security group - in the AWS console, RDS, there is an entry for security groups.

If you have not explicitly created a security group, you are probably using "default". You should probably have one group for an RDS instance.

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

+9
source

I had slight problems with these answers, so here are the steps I took to get it working ...

  • I went through ssh to my ec2 instance.
  • enter this command curl canhazip.com
  • copied the IP address that was returned
  • went to my VPC Dashboard in aws
  • clicked Security Groups in the left column
  • clicked on the checkbox next to one of the security groups.
  • clicked Edit in the Inbound Rules tab
  • this rule is added: MySQL/Aurora (3306) TCP (6) 3306 [IP from #2]/32
  • saved

I did this for each security group until the mysql connection was processed from the command line and then deleted all the ones that I did not need and checked again to make sure that I can still connect.

0
source

By default, the security group defined by AWS is not configured for a public inbound source. You will have to change the IP address of the security group to 0.0.0.0/0

-1
source

This worked for me when I added port 3306, while it was only 1433, it did not work.

therefore, a security group was created in this way

security group vpc-XXXXXX

MY SQL / TCP / 1433 / 0.0.0.0 / 0
MY SQL / TCP / 1433 / :: / 0
MTSQL / Aurora / TCP / 3306 / 0.0.0.0 / 0
MSSQL / Autora / TCP / 3306 / :: / 0

after TYPE / Protocol / Port Range / Source headers

-1
source

All Articles