11#! /bin/bash
22DATABASE_PASS=' admin123'
33sudo yum update -y
4- sudo yum install epel-release -y
4+ # sudo yum install epel-release -y
55sudo yum install git zip unzip -y
6- sudo yum install mariadb-server -y
7-
8-
6+ sudo dnf install mariadb105-server -y
97# starting & enabling mariadb-server
108sudo systemctl start mariadb
119sudo systemctl enable mariadb
1210cd /tmp/
1311git clone -b main https://github.com/hkhcoder/vprofile-project.git
1412# restore the dump file for the application
1513sudo mysqladmin -u root password " $DATABASE_PASS "
16- sudo mysql -u root -p" $DATABASE_PASS " -e " UPDATE mysql.user SET Password=PASSWORD(' $DATABASE_PASS ') WHERE User='root '"
14+ sudo mysql -u root -p" $DATABASE_PASS " -e " ALTER USER 'root'@'localhost' IDENTIFIED BY ' $DATABASE_PASS '"
1715sudo mysql -u root -p" $DATABASE_PASS " -e " DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')"
1816sudo mysql -u root -p" $DATABASE_PASS " -e " DELETE FROM mysql.user WHERE User=''"
1917sudo mysql -u root -p" $DATABASE_PASS " -e " DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%'"
@@ -23,18 +21,3 @@ sudo mysql -u root -p"$DATABASE_PASS" -e "grant all privileges on accounts.* TO
2321sudo mysql -u root -p" $DATABASE_PASS " -e " grant all privileges on accounts.* TO 'admin'@'%' identified by 'admin123'"
2422sudo mysql -u root -p" $DATABASE_PASS " accounts < /tmp/vprofile-project/src/main/resources/db_backup.sql
2523sudo mysql -u root -p" $DATABASE_PASS " -e " FLUSH PRIVILEGES"
26-
27- # Restart mariadb-server
28- sudo systemctl restart mariadb
29-
30-
31- # starting the firewall and allowing the mariadb to access from port no. 3306
32- sudo yum install firewalld -y
33- sudo systemctl start firewalld
34- sudo systemctl enable firewalld
35- sudo systemctl start firewalld
36- sudo systemctl enable firewalld
37- sudo firewall-cmd --get-active-zones
38- sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent
39- sudo firewall-cmd --reload
40- sudo systemctl restart mariadb
0 commit comments