Browse Source

Update MySQL version

lj2007331@gmail.com 6 years ago
parent
commit
2f1b38d39f
5 changed files with 35 additions and 27 deletions
  1. 1 1
      README.md
  2. 1 1
      include/check_download.sh
  3. 1 1
      include/mysql-8.0.sh
  4. 27 19
      include/upgrade_db.sh
  5. 5 5
      versions.txt

+ 1 - 1
README.md

@@ -145,6 +145,6 @@ service memcached {start|stop|status|restart|reload}
 
 ## Installation
 
-For feedback, questions, and to follow the progress of the project (Chinese): <br />
+For feedback, questions, and to follow the progress of the project: <br />
 [Telegram Group](https://t.me/oneinstack)<br />
 [OneinStack](https://oneinstack.com)<br />

+ 1 - 1
include/check_download.sh

@@ -126,7 +126,7 @@ checkDownload() {
 
         if [ "${dbinstallmethod}" == '1' ]; then
           echo "Download MySQL 8.0 binary package..."
-          FILE_NAME=mysql-${mysql80_ver}-linux-glibc2.12-${SYS_BIT_b}.tar.gz
+          FILE_NAME=mysql-${mysql80_ver}-linux-glibc2.12-${SYS_BIT_b}.tar.xz
         elif [ "${dbinstallmethod}" == '2' ]; then
           echo "Download MySQL 8.0 source package..."
           FILE_NAME=mysql-${mysql80_ver}.tar.gz

+ 1 - 1
include/mysql-8.0.sh

@@ -17,7 +17,7 @@ Install_MySQL80() {
   mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir}
 
   if [ "${dbinstallmethod}" == "1" ]; then
-    tar xzf mysql-${mysql80_ver}-linux-glibc2.12-${SYS_BIT_b}.tar.gz
+    tar xJf mysql-${mysql80_ver}-linux-glibc2.12-${SYS_BIT_b}.tar.xz
     mv mysql-${mysql80_ver}-linux-glibc2.12-${SYS_BIT_b}/* ${mysql_install_dir}
     sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe
   elif [ "${dbinstallmethod}" == "2" ]; then

+ 27 - 19
include/upgrade_db.sh

@@ -40,39 +40,43 @@ Upgrade_DB() {
         sed -i "s+^dbrootpwd.*+dbrootpwd='$dbrootpwd'+" ../options.conf
         break
       else
-        echo "${CFAILURE}$DB root password incorrect,Please enter again! ${CEND}"
+        echo "${CFAILURE}${DB} root password incorrect,Please enter again! ${CEND}"
       fi
     fi
   done
 
   echo
-  echo "${CSUCCESS}Starting $DB backup${CEND}......"
+  echo "${CSUCCESS}Starting ${DB} backup${CEND}......"
   ${db_install_dir}/bin/mysqldump -uroot -p${dbrootpwd} --opt --all-databases > DB_all_backup_$(date +"%Y%m%d").sql
-  [ -f "DB_all_backup_$(date +"%Y%m%d").sql" ] && echo "$DB backup success, Backup file: ${MSG}`pwd`/DB_all_backup_$(date +"%Y%m%d").sql${CEND}"
+  [ -f "DB_all_backup_$(date +"%Y%m%d").sql" ] && echo "${DB} backup success, Backup file: ${MSG}`pwd`/DB_all_backup_$(date +"%Y%m%d").sql${CEND}"
 
   #upgrade
   echo
-  echo "Current $DB Version: ${CMSG}${OLD_db_ver}${CEND}"
+  echo "Current ${DB} Version: ${CMSG}${OLD_db_ver}${CEND}"
   while :; do echo
-    read -p "Please input upgrade $DB Version(example: ${OLD_db_ver}): " NEW_db_ver
+    read -p "Please input upgrade ${DB} Version(example: ${OLD_db_ver}): " NEW_db_ver
     if [ `echo ${NEW_db_ver} | awk -F. '{print $1"."$2}'` == `echo ${OLD_db_ver} | awk -F. '{print $1"."$2}'` ]; then
-      if [ "$DB" == 'MariaDB' ]; then
+      if [ "${DB}" == 'MariaDB' ]; then
         DB_name=mariadb-${NEW_db_ver}-${GLIBC_FLAG}-${SYS_BIT_b}
         DB_URL=${DOWN_ADDR}/mariadb-${NEW_db_ver}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}/${DB_name}.tar.gz
-      elif [ "$DB" == 'Percona' ]; then
+      elif [ "${DB}" == 'Percona' ]; then
         DB_name=percona-server-${NEW_db_ver}
         DB_URL=http://www.percona.com/redir/downloads/Percona-Server-`echo ${NEW_db_ver} | awk -F. '{print $1"."$2}'`/LATEST/source/tarball/${DB_name}.tar.gz
-      elif [ "$DB" == 'MySQL' ]; then
+      elif [ "${DB}" == 'MySQL' ]; then
         DB_name=mysql-${NEW_db_ver}-linux-glibc2.12-${SYS_BIT_b}
-        DB_URL=${DOWN_ADDR}/MySQL-`echo ${NEW_db_ver} | awk -F. '{print $1"."$2}'`/${DB_name}.tar.gz
-      fi
-        [ ! -e "${DB_name}.tar.gz" ] && wget --no-check-certificate -c $DB_URL > /dev/null 2>&1
-        if [ -e "${DB_name}.tar.gz" ]; then
-          echo "Download [${CMSG}${DB_name}.tar.gz${CEND}] successfully! "
+        if [ `echo ${OLD_db_ver} | awk -F. '{print $1"."$2}'` == '8.0' ]; then
+          DB_URL=${DOWN_ADDR}/MySQL-`echo ${NEW_db_ver} | awk -F. '{print $1"."$2}'`/${DB_name}.tar.xz
         else
-          echo "${CWARNING}$DB version does not exist! ${CEND}"
+          DB_URL=${DOWN_ADDR}/MySQL-`echo ${NEW_db_ver} | awk -F. '{print $1"."$2}'`/${DB_name}.tar.gz
         fi
-        break
+      fi
+      [ ! -e "`ls ${DB_name}.tar.?z`" ] && wget --no-check-certificate -c ${DB_URL} > /dev/null 2>&1
+      if [ -e "`ls ${DB_name}.tar.?z`" ]; then
+        echo "Download [${CMSG}`ls ${DB_name}.tar.?z`${CEND}] successfully! "
+      else
+        echo "${CWARNING}${DB} version does not exist! ${CEND}"
+      fi
+      break
     else
       echo "${CWARNING}input error! ${CEND}Please only input '${CMSG}${OLD_db_ver%.*}.xx${CEND}'"
     fi
@@ -82,7 +86,7 @@ Upgrade_DB() {
     echo "[${CMSG}${DB_name}.tar.gz${CEND}] found"
     echo "Press Ctrl+c to cancel or Press any key to continue..."
     char=`get_char`
-    if [ "$DB" == 'MariaDB' ]; then
+    if [ "${DB}" == 'MariaDB' ]; then
       service mysqld stop
       mv ${mariadb_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
       mv ${mariadb_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
@@ -99,7 +103,7 @@ Upgrade_DB() {
       ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1
       ${mariadb_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1
       [ $? -eq 0 ] &&  echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}${OLD_db_ver}${CEND} to ${CMSG}${NEW_db_ver}${CEND}"
-    elif [ "$DB" == 'Percona' ]; then
+    elif [ "${DB}" == 'Percona' ]; then
       tar xzf ${DB_name}.tar.gz
       pushd ${DB_name}
       make clean
@@ -155,8 +159,12 @@ Upgrade_DB() {
       ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "drop database test;" >/dev/null 2>&1
       ${percona_install_dir}/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1
       [ $? -eq 0 ] &&  echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}${OLD_db_ver}${CEND} to ${CMSG}${NEW_db_ver}${CEND}"
-    elif [ "$DB" == 'MySQL' ]; then
-      tar xzf ${DB_name}.tar.gz
+    elif [ "${DB}" == 'MySQL' ]; then
+      if [ `echo ${OLD_db_ver} | awk -F. '{print $1"."$2}'` == '8.0' ]; then
+        tar xJf ${DB_name}.tar.xz
+      else
+        tar xzf ${DB_name}.tar.gz
+      fi
       service mysqld stop
       mv ${mysql_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
       mv ${mysql_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}

+ 5 - 5
versions.txt

@@ -18,10 +18,10 @@ apr_util_ver=1.6.1
 nghttp2_ver=1.32.0
 
 # DB
-mysql80_ver=8.0.11
-mysql57_ver=5.7.22
-mysql56_ver=5.6.40
-mysql55_ver=5.5.60
+mysql80_ver=8.0.12
+mysql57_ver=5.7.23
+mysql56_ver=5.6.41
+mysql55_ver=5.5.61
 
 mariadb103_ver=10.3.8
 mariadb102_ver=10.2.16
@@ -49,7 +49,7 @@ jdk16_ver=1.6.0_45
 php72_ver=7.2.8
 php71_ver=7.1.20
 php70_ver=7.0.31
-php56_ver=5.6.36
+php56_ver=5.6.37
 php55_ver=5.5.38
 php54_ver=5.4.45
 php53_ver=5.3.29