Error in Database connection

Hi @royki @akshayyw I’ve got the task to set up the database server, but getting error after all the configurations as
“Error Establishing Database connection” when I check this up on LBR server.
Below are the commands I executed to reach the destination:

----On DB server------
sudo yum install mariadb-server vim openssh-clients openssh -y > /dev/null

sudo systemctl start mariadb.service

sudo mysql_secure_installation

mysql -u root -p

CREATE DATABASE kodekloud_db8;

CREATE USER ‘kodekloud_gem’@localhost identified by ‘centos’;

grant all on kodekloud_db8.* to ‘kodekloud_gem’ identified by ‘centos’ WITH GRANT OPTION;

grant all privileges on kodekloud_db8.* to ‘kodekloud_gem’@’%’ WITH GRANT OPTION;



sudo systemctl restart mariadb.service

vim /etc/my.cnf

sudo systemctl restart mariadb.service

mysql -u kodekloud_gem -p kodekloud_db8 < /home/peter/db.sql

mysql -u kodekloud_gem -p -h stdb01

–On storage server–

cat /data/wp-config.php | grep DB_NAME

cat /data/wp-config.php | grep DB_USER

cat /data/wp-config.php | grep DB_PASSWORD

cat /data/wp-config.php | grep DB_HOST

sudo sed -i ‘s/dbname/kodekloud_db8/g’ /data/wp-config.php

sudo sed -i ‘s/dbuser/kodekloud_gem/g’ /data/wp-config.php

sudo sed -i ‘s/dbpass/pass/g’ /data/wp-config.php

—On app server—

sudo yum install mysql -y > /dev/null

mysql -u kodekloud_top -p -h stdb01