简体   繁体   中英

Cannot connect to the mysql RDS instance on AWS

I created a MySQL RDS instance on AWS. I also created an EC2 instance on which I installed Wordpress, Apache, MySQL client, and other dependencies using the script shown below.

-- Script

#!/bin/bash

yum update -y

yum install httpd php php-mysql -y

cd /var/www/html

echo "healthy" > healthcheck.html

wget https://wordpress.org/wordpress-5.1.1.tar.gz

tar -xzf wordpress-5.1.1.tar.gz

cp -r wordpress/* /var/www/html/

rm -rf wordpress

rm -rf wordpress-5.1.1.tar.gz

chmod -R 755 wp-content

chown -R apache:apache wp-content

chkconfig httpd on

service httpd start

I created a database and a master user while creating an RDS instance, and tried to host a Wordpress website. It shows this error every time ( This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at wpsdbserver.cv3al69dy8rq.us-east-1.rds.amazonaws.com. This could mean your host's database server is down ).

Both EC2 instance and RDS instance are in the same VPC, and also I have allowed port 3306 from SecurityGroup1(Ec2) to SecurityGroup2(Rds instance). I have entered the correct username, password, and database endpoint. RDS instance has no public access. The rest of the configuration settings are set to default.

Based on the comments.

The issue was caused by the use of MySQL 8 . MySQL introduced some changes that causes wordpress not to work out of the box. It has been reported several times before along with potential fixes, eg here , here or here .

The easiest way to overcome this issue is to use MySQL 5.7 which works out of the box with Wordpress.

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