简体   繁体   中英

Connecting to RDS instance from phpMyAdmin installed on EC2 server

I am trying to work on the database part of my application, but to no avail. I have RDS MySQL database that I am trying to access via (phpMyAdmin installed on my) EC2 server. I have set the credentials in the config.inc.php file of the /var/www/html/phpmyadmin folder, but when I go to log in, I get this error: 不知道我是否应该包括数据库的服务器URL或用户名

I tried to follow the answers on this AWS forum , but to no avail. My account doesn't support EC2-Classic platform in the selected region (both my EC2 and RDS instances are in US West region, but I am in Indiana).

Both my EC2 and RDS instances are in the same default VPC, and I am stuck on these instructions , let alone if I need to follow them.

Can someone help with this, and should I include the contents (sensitive info redacted, of course) of my config.inc.php ?

EDIT: I was advised by a friend to move both instances to US-East region, and gave me this to try to help me with. I don't know how to create AMI from my EC2 instance, and if this will cause me to have to start all over again on my server...

Moving the instances to a different region will solve nothing. I don't know why your friend would advise you to do that.

You just need to add a rule to the security group both instances belong to allowing traffic between instances in that security group.

Putting your RDS under the same VPC subnet with the EC2, you should able to perform a telnet to the RDS 3306 port.

When you create RDS, you need to create Database security group (this is not the VPC security group that act as sort of firewall), that consist of different subnet address in 2 different Availability Zone(AZ). eg CIDR 172.16.1.0/24 for AZ 1a , CIDR 172.16.2.0/24 for AZ 1b

If you didn't plan to make use of the multiple-AZ redundancy, during RDS launch, you must explicit state NOT to use the multi-zone startup.

If you didn't do that, RDS instance might launch inside different subnet AZ than your EC2 subnet. For example, your EC2 is in CIDR 172.16.1.0/24 AZ-1a now assign with IP address 172.16.1.15.

While your RDS because the multizone setup, just decide to launch inside CIDR 172.16.2.0/24 AZ-1b. Because they are in different AZ, there is NO route for them. Even they are the same VPC. IP in different AZ need some gateway and routing to connect.

This has nothing to do with region setup.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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