[SOLVED] AWS Wordpress database errror after install

#1
Hello,

I am following the LiteSpeed WordPress Quickstart guide but get stuck on step 4. Please see my progress through the guide below. Any help to proceed is appreciated.

Step 1
I launched a WordPress with LiteSpeed Cache (Powered OpenLiteSpeed) Server through the machine image found on AWS.
Version: 5.9
Operation System: Linux/Unix, Ubuntu 20.04 | 64-bit (x86)
Updated: 2/7/22 (American date format)
EC2 instance: t2.nano
Storage: 8GB (GP2 SSD)
[EDIT: now references correct AWS image]

Step 2
I connected to the server by SSH through AWS's cloud console.

Step 3
I followed the interactive script by entering the domain, updating the server and rebooting.

Step 4
I visited the server in a browser expecting to see to the WordPress language selection as indicated by the guide. However, I see the error message Error establishing a database connection.

As this is a vanilla installation of a prepared server image I am surprised to see this error.

Thanks,
new2litespeed
 
Last edited:
#2
This was solved by ensuring WordPress correctly references the database. Note: the following instructions will work for a vanilla ListSpeed Web Server with WordPress launched through AWS. Depending on the exact server setup the following instructions may vary.

Stop the database service
sudo service mysql stop

Create a file which the database can run when it next starts. This file will set the database password for WordPress:
touch /home/ubuntu/mysql-init

Modify the file:
nano /home/ubuntu/mysql-init

Add the following line with a password of your choice:
ALTER USER 'wordpress'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD_HERE';

Then type Ctrl+X to exit the text editor then type y to save.

Start the database service running the prepared file:
mysqld --user=root --init-file=/home/ubuntu/mysql-init

Stop the database service again now the file has been applied by typing Ctrl+C.

Start the database server once again, but in the normal way:
sudo service mysql start

Modify the WordPress config file:
nano /var/www/html/wp-config.php

ensure the DB_HOST is localhost
ensure the DB_NAME is wordpress
ensure the DB_USER is wordpress
ensure the DB_PASSWORD matches the newly created database password

Then type Ctrl+X to exit the text editor then type y to save.

Following these instructions I can now see the WordPress language selection and continue with the guide.
 
Last edited:
Top