-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmysql.sh
More file actions
68 lines (65 loc) · 2.1 KB
/
Copy pathmysql.sh
File metadata and controls
68 lines (65 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# Default variables
function="install"
# Options
. <(wget -qO- https://raw.githubusercontent.com/1Malenok1/Stuff/main/colours.sh) --
option_value(){ echo "$1" | sed -e 's%^--[^=]*=%%g; s%^-[^=]*=%%g'; }
while test $# -gt 0; do
case "$1" in
-h|--help)
. <(wget -qO- https://raw.githubusercontent.com/1Malenok1/Stuff/main/logo_mms.sh)
echo
echo -e "${C_LGn}Functionality${RES}: the script installs or uninstalls MySQL"
echo
echo -e "${C_LGn}Usage${RES}: script ${C_LGn}[OPTIONS]${RES}"
echo
echo -e "${C_LGn}Options${RES}:"
echo -e " -h, --help show the help page"
echo -e " -un, --uninstall uninstall MySQL (${C_R}completely delete all databases${RES})"
return 0 2>/dev/null; exit 0
;;
-u|-un|--uninstall)
function="uninstall"
shift
;;
*|--)
break
;;
esac
done
# Functions
install() {
echo -e "${C_LGn}MySQL installation...${RES}"
sudo apt update
sudo apt upgrade -y
sudo apt install mysql-server mysql-client -y
echo -e "
Execute it to continue the installation:
${C_LGn}sudo mysql_secure_installation${RES}
"
}
uninstall() {
echo -e "${C_LGn}MySQL uninstalling...${RES}"
sudo systemctl stop mysql
sudo killall -KILL mysql mysqld_safe mysqld
sudo apt -y purge mysql-server mysql-client
sudo apt -y autoremove --purge
sudo apt autoclean
deluser --remove-home mysql
sudo delgroup mysql
rm -rf /etc/apparmor.d/abstractions/mysql /etc/apparmor.d/cache/usr.sbin.mysqld /etc/mysql /var/lib/mysql /var/log/mysql* /var/log/upstart/mysql.log* /var/run/mysqld
sudo find / -name .mysql_history -delete
echo -e "${C_LGn}Done!${RES}"
}
# Actions
$function
echo -e "${Bl_Gn}All Operation Completed!${RES}"
. <(wget -qO- https://raw.githubusercontent.com/1Malenok1/Stuff/main/logo_mms.sh)
echo
echo -e "${C_LGn}Visit our resources:${RES}"
echo -e "${C_C}https://mms.team${RES} — Main_Site"
echo -e "${C_C}https://t.me/nftmms${RES} — MMS_Research_Chat"
echo -e "${C_C}https://t.me/cosmochannel_mms${RES} — MMS_Cosmos_Ecosystem_Chat"
echo -e "${C_C}https://t.me/mmsnodes${RES} — MMS_Nodes_Chat"
echo -e "${C_C}https://nodes.mms.team${RES} — Guides_and_Manual's"
echo