Mariadb is the fork of MysqlDB. So you see similar commands to install MysqlDB and MariaDB
C- Let’s Copy the file from Jump host to DB home folder:-
thor@jump_host ~$ sftp peter@stdb01
peter@stdb01’s password:
Connected to stdb01.
db.sql
sftp> put db.sql
Uploading db.sql to /home/peter/db.sql
db.sql 100% 45KB 19.4MB/s 00:00
sftp> exit
@@@@Login into DB Server@@@@@@@@@@@@
############################################################################################################################
ssh peter@stdb01
A- Configure Maria DB Server:-
yum install mariadb-server
systemctl enable --now mariadb
shell command:
#mysql_secure_installiation
set root password: Y
– type your root password twice
– Accept all remaning questions as yes : Y
– Remove anonymous users – Y
– Disallow login to root remotely – y
– Remove Test DB – Y
– Reload privileage tables – Y
- Test your password and DB
#mysql -u root -p
enter root password when prompt
MariaDB[(none)]> show databases;
##############################################################################################################################
B- Create DB:
#mysql -u root -p
MariaDB[(none)]> CREATE DATABASE kodekloud_db6 CHARACTER SET utf8 COLLATE utf8_bin;
*****you need to exit mariadb console (quit) to run restore DB Script *:
Restore db: (we are going to use the file we copied to home folder)
#mysql -uroot -p kodekloud_db6 < /home/peter/db.sql
################################################################################
D- Create DB user
#mysql -u root -p
MariaDB[(none)]>CREATE USER ‘kodekloud_sam’@‘%’ IDENTIFIED BY ‘yourpassword’;
MariaDB[(none)]>FLUSH PRIVILEGES;
#################################################################################
E- Grant full permissions:
#mysql -u root -p
MariaDB[(none)]>GRANT ALL PRIVILEGES ON kodekloud_db6.* TO ‘kodekloud_sam’@‘%’ identified by ‘yourpassword’;
MariaDB[(none)]>FLUSH PRIVILEGES;
MariaDB[(none)]>quit;
#vi /etc/my.cnf
bind-address=172.16.239.10
port=3306
#systemctl restart mariadb
#systemctl status mariadb
#################################################################################
F- Update config file
— > login to storage server:
ssh natasha@ststor01
sudo sed -i ‘s/dbname/kodekloud_db6/g’ /data/wp-config.php
sudo sed -i ‘s/dbuser/kodekloud_sam/g’ /data/wp-config.php
sudo sed -i ‘s/dbpass/yourpassword/g’ /data/wp-config.php
sudo sed -i ‘s/dbhost/stdb01/g’ /data/wp-config.php
Testing using the + icon using 80 port you should see a website up.
Thank you
Jay
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$