flush_query_cache.sh: fix error if mysql distribution is not MySQL (i.e. Percona/MariaDB).

This commit is contained in:
Christoph 2018-12-05 18:26:40 +01:00
parent 435fbfdf19
commit a494755a15

View File

@ -28,16 +28,30 @@ MYSQL_MAJOR_VERSION=`echo $CURRENT_VERSION | cut -d '.' -f1`
MYSQL_MINOR_VERSION=`echo $CURRENT_VERSION | cut -d '.' -f2`
MYSQL_PATCH_LEVEL=`echo $CURRENT_VERSION | cut -d '.' -f3`
if [[ "$MYSQL_MAJOR_VERSION" -gt 8 ]] \
|| ( [[ "$MYSQL_MAJOR_VERSION" -eq 8 ]] && [[ "$MYSQL_MINOR_VERSION" -gt 0 ]] ) \
|| ( [[ "$MYSQL_MAJOR_VERSION" -eq 8 ]] && [[ "$MYSQL_MINOR_VERSION" -eq 0 ]] \
&& [[ $MYSQL_PATCH_LEVEL -ge 3 ]] ); then
if [[ -z "$_MYSQLD_VERSION" ]]; then
echo ""
echo -e "\t[ Error ]: Query cache is no longer supported since (MySQL 8.0.3)"
echo -e "\t[ Error ]: No installed MySQL server or distribution found!"
echo ""
elif [[ "$_MYSQLD_VERSION" =~ MariaDB ]]; then
MYSQL_CUR_DISTRIBUTION="MariaDB"
elif [[ "$(basename "$(realpath "/usr/local/mysql")")" =~ percona- ]]; then
MYSQL_CUR_DISTRIBUTION="Percona"
elif [[ "$(basename "$(realpath "/usr/local/mysql")")" =~ mysql- ]]; then
MYSQL_CUR_DISTRIBUTION="MySQL"
fi
if [[ "$MYSQL_CUR_DISTRIBUTION" = "MySQL" ]]; then
if [[ "$MYSQL_MAJOR_VERSION" -gt 8 ]] \
|| ( [[ "$MYSQL_MAJOR_VERSION" -eq 8 ]] && [[ "$MYSQL_MINOR_VERSION" -gt 0 ]] ) \
|| ( [[ "$MYSQL_MAJOR_VERSION" -eq 8 ]] && [[ "$MYSQL_MINOR_VERSION" -eq 0 ]] \
&& [[ $MYSQL_PATCH_LEVEL -ge 3 ]] ); then
echo ""
echo -e "\t[ Error ]: Query cache is no longer supported since (MySQL 8.0.3)"
echo ""
exit
fi
fi
exit
#---------------------------------------