Can't connect a DB to AWS

邮差的信 提交于 2019-12-24 15:44:57

问题


I'm using AWS for my project and Laravel 5. Just installed my laravel project in the EC2 and set up a DB in RDS. I imported the .sql file using mysql workbench. In my .env I set up the host, the DB name, user and password but when I go to the project in the browser I get an error:

PDOException in Connector.php line 55: 
SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'blue*****.************.us-west-2.rds.amazonaws.com' (4) 

Put the * for security reasons. So what could be wrong?

Update:

When I tried to connect to the RDS instance using the command line I got:

ERROR 2003 (HY000): Can't connect to MySQL server on 'blue****.**********.us-west-2.rds.amazonaws.com' (110)

回答1:


The reason you are not able to connect to the RDS instance from the EC2 instance has to do with security group.

Before your EC2 instance can communicate with the RDS server, you need to configure a security group for the RDS.

You can check this and this for more details.



来源:https://stackoverflow.com/questions/35840504/cant-connect-a-db-to-aws

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!