简体   繁体   English

无法从 Amazon linux EC2 实例上的 Wordpress 连接到 RDS mysql 数据库

[英]Can't Connect to RDS mysql DB from Wordpress on Amazon linux EC2 Instance

I am getting Error establishing a database connection while trying to connect to mysql on Amazon RDS from my Wordpress instance.尝试从我的 Wordpress 实例连接到 Amazon RDS 上的 mysql 时,我在Error establishing a database connection

Wordpress is on my AWS Linux EC2 Instance, both are on the same VPC, same Security Group allowing 3306 inbound rule, db credentials in wp-config is also correct. Wordpress 在我的 AWS Linux EC2 实例上,两者都在同一个 VPC 上,同一个安全组允许 3306 入站规则,wp-config 中的 db 凭证也是正确的。

I am able to connect to my mysql RDS instance while ssh with the following command and it connects fine:我可以使用以下命令连接到我的 mysql RDS 实例,而 ssh 可以正常连接:

mysql -h "endpoint url" -u "username" -p "password";

However, when accessing the EC2 EIP on the browser to setup my WP final configuration I get the error connecting DB.但是,当在浏览器上访问 EC2 EIP 以设置我的 WP 最终配置时,我收到连接数据库的错误。

Did you check your security group?你检查你的安全组了吗? Because you have to open the MySQL Port 3306.因为你必须打开 MySQL 端口 3306。

When you are creating the RDS, it is important to create a new security group, like myRDSgroup, later you have to modify it by open the port 3306 in the source select the security group where your AWS EC2 is located.在创建 RDS 时,创建一个新的安全组很重要,例如 myRDSgroup,稍后您必须通过在源 select 中打开端口 3306 来修改它,该安全组是您的 AWS EC2 所在的安全组。

Could you send your security group screenshot, please?请把你的安全组截图发给我好吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM