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;
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
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
0 comments:
Post a Comment