无法从Amazon Linux EC2实例上的Wordpress连接到RDS mysql DB [英] Can't Connect to RDS mysql DB from Wordpress on Amazon linux EC2 Instance

查看:63
本文介绍了无法从Amazon Linux EC2实例上的Wordpress连接到RDS mysql DB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从我的Wordpress实例连接到Amazon RDS上的mysql时,我得到建立数据库连接时出错.

I am getting Error establishing a database connection while trying to connect to mysql on Amazon RDS from my Wordpress instance.

Wordpress在我的AWS Linux EC2实例上,都在同一VPC上,同一安全组允许3306入站规则,wp-config中的数据库凭证也正确.

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.

我可以使用以下命令在ssh时连接到我的mysql RDS实例,并且可以正常连接:

I am able to connect to my mysql RDS instance while ssh with the following command and it connects fine:

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

但是,当在浏览器上访问EC2 EIP设置我的WP最终配置时,出现连接DB的错误.

However, when accessing the EC2 EIP on the browser to setup my WP final configuration I get the error connecting DB.

推荐答案

您是否检查了安全组?因为您必须打开MySQL端口3306.

Did you check your security group? Because you have to open the MySQL Port 3306.

创建RDS时,创建一个新的安全组(例如myRDSgroup)很重要,稍后您必须通过打开源中的端口3306并选择AWS EC2所在的安全组来对其进行修改.

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.

能否请您发送安全组屏幕截图?

Could you send your security group screenshot, please?

这篇关于无法从Amazon Linux EC2实例上的Wordpress连接到RDS mysql DB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆