Install and Configure DB Server Kodekloud

 


Solution:

Login to db server ssh@stdb01

Then login as root

sudo su

Now, run these commands

sudo yum install -y mariadb-server

sudo yum install -y mariadb*

systemctl restart mariadb

sudo systemctl enable mariadb && systemctl start mariadb && systemctl status mariadb

sudo mysql_secure_installation

Now, login with root password that you have given and grant permission

mysql -u root -p
create database kodekloud_db9;
create user 'kodekloud_aim'@localhost identified by 'pass';
grant all on kodekloud_db9.* to 'kodekloud_aim' identified by 'pass' WITH GRANT OPTION;
grant all privileges on kodekloud_db9.* to 'kodekloud_aim'@'%' WITH GRANT OPTION;
 
FLUSH PRIVILEGES;
exit
 
vi /etc/my.cnf
 
bind-address=172.16.239.10
port=3306
Now install openssh clients

yum install httpd -y

yum install openssh-clients

Go to jump server and also install openssh clients. Now copy db.sql from jump server to db server

scp  /home/thor/db.sql peter@stdb01:/tmp

Go  to db server and import db.sql to created datatbase

mysql -u kodekloud_aim -p kodekloud_db9 < /tmp/db.sql

systemctl restart mariadb

Check from server

mysql -u kodekloud_aim -p -h stdb01
mysql -u kodekloud_aim -p -h localhost

Next go to storage server and login as root

Now check the configuration

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

Replace with correct configuration

sudo sed -i 's/dbname/kodekloud_db7/g' /data/wp-config.php
sudo sed -i 's/dbuser/kodekloud_top/g' /data/wp-config.php
sudo sed -i 's/dbpass/pass/g' /data/wp-config.php
sudo sed -i 's/dbhost/stdb01/g' /data/wp-config.php
 
 
 

Download Coding Interview Book and Get More Tutorials for Coding and Interview Solution: Click Here

Download System Design Interview Book and Get More Tutorials and Interview Solution: Click Here

Do you need more Guidance or Help? Then Book 1:1 Quick Call with Me: Click Here

Share on Google Plus

About Ashadullah Shawon

I am Ashadullah Shawon. I am a Software Engineer. I studied Computer Science and Engineering (CSE) at RUET. I Like To Share Knowledge. Learn More: Click Here
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment