3
votes

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.

1
Guess you are using RDS MySQL 8? Please try with 5.7.Marcin
Are EC2 and RDS in the same subnet, if not , what about ACLs configurationAsri Badlah
@Marcin Yes earlier i was using MySql 8, I now tried the same process with MySql version 5.7.23 and it worked. Can you please explain why this didn't work with Version 8 and worked with Version 5abhnvjn
@AsriBadlah All the Subnet and ACL settings are set to default. Thanksabhnvjn
I provided an answer with some info. If you find the answer helpful, its acceptance would be appreciated.Marcin

1 Answers

1
votes

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, e.g. 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.