Connect to MySQL on AWS from local machine

前端 未结 6 1903
轮回少年
轮回少年 2020-12-23 11:48

I am trying to set up a dev environment on my local machine that accesses a MySQL DB on AWS, but I keep getting a \"Can\'t connect\" message.

mysql_connect(\         


        
6条回答
  •  孤城傲影
    2020-12-23 12:21

    If you are using MySql on AWS via an RDS instance you must add the IP address you want to connect from to the "DB Security Groups". To do this go to your AWS Managment Console and select RDS.
    1. Select "DB Security Groups" on the left panel
    2. Select "default"
    3. Select "CIDR/IP" from the select box and enter your workstations public IP address. Example:
    23.234.192.123/32 (dont forget the /32 for a single ip)
    4. Click "Add"
    5. Wait a few minutes for it to go into effect and then connect your MySql client.

    This only applies for RDS instances, if you are using MySql installed on an EC2 instance then the instructions are the same as accessing MySql from any remote machine.

提交回复
热议问题