Install / configure mariadb

I have done the following for installing and configuring mariadb:

  1. ssh peter@stdb01

  2. sudo yum install openssh-client

  3. scp db.sql peter@stdb01:~/ from jump_host

  4. ssh peter@stdb01

  5. sudo yum install mariadb-server
    sudo systemctl start mariadb
    sudo systemctl enable mariadb
    sudo systemctl status mariadb
    sudo mysql_secure_installation

  6. CREATE USER kodekloud_gem IDENTIFIED BY ‘password’;
    CREATE DATABASE kodekloud_db1;
    GRANT ALL privileges ON kodekloud_db1.* TO kodekloud_gem;
    mysql -u kodekloud_gem -p kodekloud_db1 < db.sql;

  7. ssh tony@stapp01
    mysql -u kodekloud_gem -p -h stdb01

  8. ssh steve@stapp02
    mysql -u kodekloud_gem -p -h stdb01

  9. ssh banner@stapp03
    mysql -u kodekloud_gem -p -h stdb01

  10. edited wp-config in all app servers
    db_name ‘kodekloud_db1’
    db_user ‘kodekloud_gem’
    db_host ;localhost’
    db_pass ‘password’

After doing the above steps I am still getting an error: “connection cannot be established to database”

Please see the below screenshots.

Seems like you are passing incorrect DB host i.e localhost in wp-config file. Please not that database is running on Database server instead.

Hi Inderpreet,

I did the same above steps mentioned in my previous post for installing & Configuring
mariadb with changes to user: kodekloud_pop, db: kodekloud_db8.

CREATE USER kodekloud_pop IDENTIFIED BY ‘password’;
CREATE DATABASE kodekloud_db8;
GRANT ALL privileges ON kodekloud_db8 .* TO kodekloud_pop;
mysql -u kodekloud_pop -p kodekloud_db8 < db.sql;

wp-config edited as follows:

db_name ‘kodekloud_db8’
db_user ‘kodekloud_pop’
db_host '
db_pass ‘password’

database server hostname from wiki:

The result I keep getting is the same. What am I doing wrong?

for the db host you need to enter ip:port number

In wp-config. php set debug to true. So that you can get error message. what exactly went wrong.Also add port number dn=b_host.
Also add 3 lines in /etc/my.cnf file in mysqld section.