From 21578a3211f6edf9c92c60305e276a1d2bd4963e Mon Sep 17 00:00:00 2001 From: ankiteric Date: Tue, 20 Apr 2021 18:49:58 +0530 Subject: [PATCH 1/6] Update M-AB.sh --- M-AB.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/M-AB.sh b/M-AB.sh index bbdebb7..3c30b47 100644 --- a/M-AB.sh +++ b/M-AB.sh @@ -1,5 +1,6 @@ #!/bin/bash +### written by Ankit Kapoor #### ### This script will install the mysqld from the binary files.User can download the binary files ### from the mysql official website. Only condition for this script to work is that the tar or zipped file should be untar and the folder should be in a place. ### This script will start from creating the group and user and if already exist will skip to the next path where it will create the data directory,log directory From 0e596edaf8c3ab254d8d991bc6f2946fe93674bd Mon Sep 17 00:00:00 2001 From: ankiteric Date: Tue, 20 Apr 2021 19:56:46 +0530 Subject: [PATCH 2/6] Delete README.md --- README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 7a4362c..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# M-AB - -MySQL automatic binary installation. Usually to make our life easy while installing mysql we usually use rpm files which straight away install the mysql engine on the linux machine. But one of the main disadvantage is that it bound you with the file locations or the path locations of data directory or log file (where error log resides ). User cannot choose the file location on their own and user needs to rely on rpm packages solely. This can also cause security issues because the file location will remain same and will be easy to find the paths. But with binary installation i.e. tar file user has an independence to define their own path and has an option to make sure if all the files has been successfully installed. Moreover in case if mysql is not running then it becomes quite easy to troubleshoot. With M-AB user can install the mysqld according to their own requirements i.e without going through all the steps needed to execute manually in tar files. M-AB will start from checking if any other mysqld is already running on the system. With M-AB user should make sure that the untar file of mysql must be placed on the system (where mysql required to be installed) before running this programm. From 4d7dfb0a8fcb63288f220aade56f253ed8ee6cdb Mon Sep 17 00:00:00 2001 From: ankiteric Date: Tue, 20 Apr 2021 20:20:44 +0530 Subject: [PATCH 3/6] Update M-AB.sh --- M-AB.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/M-AB.sh b/M-AB.sh index 3c30b47..779eacc 100644 --- a/M-AB.sh +++ b/M-AB.sh @@ -1,3 +1,20 @@ +/***************************************************************************** +Copyright (c) 2021 M-AB + +All Rights Reserved. +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License, version 2.0, +as published by the Free Software Foundation. +This program is also distributed with certain software (including +but not limited to OpenSSL) that is licensed under separate terms, +as designated in a particular file or component or in included license +documentation. The authors of M-AB hereby grant you an additional +permission to link the program and your derivative works with the +separately licensed software that they have included with M-AB. +*****************************************************************************/ + + + #!/bin/bash ### written by Ankit Kapoor #### From c9e4fe141aa34125ce08ec5c26b041fb2e484a5b Mon Sep 17 00:00:00 2001 From: ankiteric Date: Sat, 24 Apr 2021 23:26:57 +0530 Subject: [PATCH 4/6] Update M-AB.sh --- M-AB.sh | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/M-AB.sh b/M-AB.sh index 779eacc..435112d 100644 --- a/M-AB.sh +++ b/M-AB.sh @@ -1,17 +1,16 @@ -/***************************************************************************** -Copyright (c) 2021 M-AB - -All Rights Reserved. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License, version 2.0, -as published by the Free Software Foundation. -This program is also distributed with certain software (including -but not limited to OpenSSL) that is licensed under separate terms, -as designated in a particular file or component or in included license -documentation. The authors of M-AB hereby grant you an additional -permission to link the program and your derivative works with the -separately licensed software that they have included with M-AB. -*****************************************************************************/ +#Copyright (c) 2021 M-AB + +#All Rights Reserved. +#This program is free software; you can redistribute it and/or modify +#it under the terms of the GNU General Public License, version 2.0, +#as published by the Free Software Foundation. +#This program is also distributed with certain software (including +#but not limited to OpenSSL) that is licensed under separate terms, +#as designated in a particular file or component or in included license +#documentation. The authors of M-AB hereby grant you an additional +#permission to link the program and your derivative works with the +#separately licensed software that they have included with M-AB. + From fbb092238ba6851c51112ef19e4e13687624f1bd Mon Sep 17 00:00:00 2001 From: ankiteric Date: Sat, 24 Apr 2021 23:27:41 +0530 Subject: [PATCH 5/6] Update M-AB.sh --- M-AB.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/M-AB.sh b/M-AB.sh index 435112d..7aa777e 100644 --- a/M-AB.sh +++ b/M-AB.sh @@ -11,7 +11,7 @@ #permission to link the program and your derivative works with the #separately licensed software that they have included with M-AB. - +### Written by Ankit Kapoor #!/bin/bash From bf2fe8679d931c9ad91df4d7e79cc92f33e1c503 Mon Sep 17 00:00:00 2001 From: ankiteric Date: Sat, 24 Apr 2021 23:29:36 +0530 Subject: [PATCH 6/6] Delete M-AB.sh This file already exist in main branch and there is no need to maintain two different copies of same code. --- M-AB.sh | 181 -------------------------------------------------------- 1 file changed, 181 deletions(-) delete mode 100644 M-AB.sh diff --git a/M-AB.sh b/M-AB.sh deleted file mode 100644 index 7aa777e..0000000 --- a/M-AB.sh +++ /dev/null @@ -1,181 +0,0 @@ -#Copyright (c) 2021 M-AB - -#All Rights Reserved. -#This program is free software; you can redistribute it and/or modify -#it under the terms of the GNU General Public License, version 2.0, -#as published by the Free Software Foundation. -#This program is also distributed with certain software (including -#but not limited to OpenSSL) that is licensed under separate terms, -#as designated in a particular file or component or in included license -#documentation. The authors of M-AB hereby grant you an additional -#permission to link the program and your derivative works with the -#separately licensed software that they have included with M-AB. - -### Written by Ankit Kapoor - - -#!/bin/bash - -### written by Ankit Kapoor #### -### This script will install the mysqld from the binary files.User can download the binary files -### from the mysql official website. Only condition for this script to work is that the tar or zipped file should be untar and the folder should be in a place. -### This script will start from creating the group and user and if already exist will skip to the next path where it will create the data directory,log directory -### and the configuration file after taking input from the user. - - -########### Step 0 to check if there is already an existing process of mysql ###################### - -echo "Checking if mysqld is already running on this system" -is_running=yes -ps cax | grep mysql > /dev/null -if [ $? -eq 0 ]; - then - echo "mysqld is already running." - echo "Do you want to kill this process and re install database" - read input - if [ "${input^^}" == "${is_running^^}" ]; - then - id=$(ps cax | grep mysql | grep -o '^[0-9]*') - echo $id && kill $id - echo "Process "$id "has been killed successfully. Proceeding towards the installation" - else - echo "exiting this programm" - exit 1 - fi - else - echo "Process is not running and hence proceed towards the installation" -fi - - -sleep 3 - - -############# Step 1 is to check if mysql group exist #################### -b=mysql - -echo "Checking if group "$b "already exist and if not create one........." - -a=$(grep mysql /etc/group | cut -d : -f 1) -if [ "$a" = $b ]; - then - echo "Group "$b "already exist" - else - echo "Group "$b "not exist and thus adding..." - groupadd mysql - result=$? - if [ "$result" = 0 ]; - then - echo "group succesfully added" - else - echo "group addition failed" - fi -fi - -sleep 2 - -########### Step 2 is to create the user mysql and add it to the group mysql################ - -echo "Now Add user "$b - -useradd -r -g $b $b 2>/dev/null -result=$? - - if [ "$result" = 0 ]; - then - echo "user succesfully added to the group "$b - else - echo "user already existing" - fi - -sleep 2 - -############## Step 3 is to create the data directory, log file directory, configuration file with minimum parameters required to start mysqld ################# - -echo "Enter the data directory path.For example /data01/" -read dpath - -until mkdir $dpath 2>/dev/null - do - mkdir $dpath 2>/dev/null - echo "this path already exist. Please try again" - read dpath - done -chmod -R 750 $dpath && chown -R mysql:mysql $dpath -echo "Data directory created and permission and ownership assigned" - -sleep 2 - -echo "Now creating the log file directory where error file exist. Please enter the log directory.For example /log01" -read lpath - -until mkdir $lpath 2>/dev/null - do - mkdir $lpath 2>/dev/null - echo "this path already exist. Please try again" - read lpath - done - - echo "creating log error file now...." - touch $lpath/error.log && chmod -R 750 $lpath && chown -R mysql:mysql $lpath - echo "created successfully" - echo "log directory successfully created, permission and ownership assigned" - - -sleep 2 - -echo "cnf file will be created in the /etc folder for ease of understanding and user can move it to another location if required....." -echo "creating now...." - -touch /etc/my.cnf - result=$? - if [ "$result" = 0 ]; - then - echo "cnf file succesfully created adding parameters now" - a="[mysqld]" - b="user=mysql" - c="datadir=$dpath" - d="log-error=$lpath/error.log" - echo -e "$a\n$b\n$c\n$d" > /etc/my.cnf - else - echo "configuration file not created..." - fi -sleep 2 - -######## Step 4 ################### - -echo "Now mysql database will install.Installing........" -echo "please provide the path to the mysql bin folder. For example /mysql-8.0.23-linux-glibc2.12-x86_64/bin" -read mysqld -echo "database installing........." -$mysqld/mysqld --datadir=$dpath --initialize --user=mysql - - if [ "$result" = 0 ]; - then - echo "database has been successfully installed under "$dpath - else - echo "Database creation failed please check..." - fi -sleep 3 - -########## Step 5 ################### - -echo "initialising database..........." -nohup $mysqld/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql > /dev/null 2>&1 & -result=$? - if [ "$result" = 0 ]; - then - echo "Database has been initialised successfully" - else - echo "Not installed...Error in installing" - fi - -sleep 2 -########## Step 6 ################### - -######## to change the password ####### - -rpassword=$(grep -w "A temporary password is generated for root@localhost" $lpath/error.log | cut -d " " -f 13) -echo "Your password is "$rpassword -echo "Login into database using mysql -uroot -p'"$rpassword"'and change the password using alter user root@localhost identified by 'your password'; and then followed by 'flush privileges;'" -sleep 2 -echo "exiting now...."