How to Configure WordPress with MySQL Database over AWS using AWS RDS ?
3 min readSep 26, 2021
So, let’s get started…
Step 1:- First, launch an ec2 instance and make sure that your security group has allowed all traffic.
Step 2:- Next, create a database (RDS).
- Search for RDS in search bar and click on Create Database
- Select Standard create and Select Engine MYSQL.
- MYSQL version MYSQL 5.7.31 and template — Free tier
- Provide the credentials
- Give public access and click on create database.
- Our Database is ready.
Step 3:- Now, connect with ec2-instance and install the requirements which are as follows:-
- Update your repo using the following command:-
dnf update -y
- Install fedora rpm. The command for the same is as follows:-
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
- Install wget software to download packages from Internet.
yum install wget -y
- Configure Apache web server. The command for the same are as follows:-
yum install httpd
systemctl start httpd
systemctl status httpd
- Install PHP software requirements and MySQL database by using the following command:-
dnf install http://rpms.remirepo.net/enterprise/remi-release-8.rpm dnf module install php:remi-7.4
dnf install php-mysqlnd
dnf install mysql -y
Step 4:- Next, connect RDS with ec2-instance and create a database.
mysql -h <Database Endpoint> -u <username> -p
Your database endpoint will be visible when you click and scroll down the database you created.
Step 5:- Now, we will configure the WordPress. Follow the below steps for the same:-
- Download WordPress
wget http://wordpress.org/latest.tar.gz
- Unzip it
`tar -xvzf latest.tar.gz -C /var/www/html
- Go to the root directory. Add your database name, username, password and database end point.
cd /var/www/html/wordpresswp-config-sample.php
- Restart your httpd service and set selinux permission by using following command:-
systemctl restart httpd
setenforce 0
Step 6:- Open WordPress in browser by using instance public IP ,add your credentials and install WordPress.
Finally, login by using your credentials.
Thank you :)