Cant connect to mysql server on AWS RDS

前端 未结 2 1863
耶瑟儿~
耶瑟儿~ 2021-02-14 19:43

I am new to AWS RDS. I have created RDS instance.But i dont know, how can i connect this DB. I tried like this

mysql -h awsinstanamehere.rds.amazonaws.com -P 33         


        
相关标签:
2条回答
  • 2021-02-14 20:15

    I was having a little trouble with these answers so here are the steps I followed to get it working...

    1. Logged in via ssh to my ec2 instance.
    2. typed this command, curl canhazip.com
    3. copied the ip address that was returned
    4. went to my VPC Dashboard in aws
    5. clicked on Security Groups in the left column
    6. clicked on the checkbox next to one of the security groups
    7. clicked Edit under the Inbound Rules tab
    8. added this rule : MySQL/Aurora (3306) TCP (6) 3306 [IP from #2]/32
    9. saved

    I did this for every security group until the mysql connection worked from the command line, then deleted all of the ones that I didn't need, and retested to make sure I could still connect.

    0 讨论(0)
  • 2021-02-14 20:27

    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.

    0 讨论(0)
提交回复
热议问题