second run: determin 'MYSQL_CREDENTIAL_ARGS' if not given.
This commit is contained in:
@@ -64,18 +64,47 @@ if [[ -f "$conf_file" ]]; then
|
||||
source "$conf_file"
|
||||
fi
|
||||
|
||||
[[ -z "$mysql_credential_args" ]] && mysql_credential_args="--defaults-file=/usr/local/mysql/sys-maint.cnf"
|
||||
#[[ -z "$mysql_credential_args" ]] && mysql_credential_args="--defaults-file=/usr/local/mysql/sys-maint.cnf"
|
||||
|
||||
if [[ -z "$mysql_credential_args" ]]; then
|
||||
|
||||
if [[ "$MYSQL_CUR_DISTRIBUTION" = "MariaDB" ]] && ([[ $MYSQL_MAJOR_VERSION -gt 10 ]] \
|
||||
|| ( [[ $MYSQL_MAJOR_VERSION -eq 10 ]] && [[ $MYSQL_MINOR_VERSION -gt 3 ]] )) ; then
|
||||
if [[ -S "/tmp/mysql.sock" ]]; then
|
||||
mysql_credential_args="-u root -S /tmp/mysql.sock"
|
||||
elif [[ -S "/var/run/mysqld/mysqld.sock" ]]; then
|
||||
mysql_credential_args="-u root -S /var/run/mysqld/mysqld.sock"
|
||||
else
|
||||
fatal "Parameter 'MYSQL_CREDENTIAL_ARGS' cannot be determined automated.
|
||||
|
||||
Use configuration file "$conf_file" to set
|
||||
parameter manually."
|
||||
fi
|
||||
else
|
||||
if [[ -f "/usr/local/mysql/sys-maint.cnf" ]] ; then
|
||||
mysql_credential_args="--defaults-file=/usr/local/mysql/sys-maint.cnf"
|
||||
elif [[ -f "/etc/mysql/debian.cnf" ]] ; then
|
||||
mysql_credential_args="--defaults-file=/etc/mysql/debian.cnf"
|
||||
else
|
||||
fatal "Parameter 'MYSQL_CREDENTIAL_ARGS' cannot be determined automated.
|
||||
|
||||
Use configuration file "$conf_file" to set
|
||||
parameter manually."
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if $LOGGING ;then
|
||||
echo -e "\n[ `date` ] Going to flush query cache.."
|
||||
fi
|
||||
|
||||
if [ -n "$mysql_credential_args" ] ; then
|
||||
$mysql $mysql_credential_args -N -s -e "FLUSH QUERY CACHE"
|
||||
else
|
||||
$mysql -u$mysql_user -p$mysql_password -N -s -e "FLUSH QUERY CACHE"
|
||||
fi
|
||||
|
||||
# Flush Query Cache
|
||||
#
|
||||
$mysql $mysql_credential_args -N -s -e "FLUSH QUERY CACHE"
|
||||
|
||||
[[ $? -gt 0 ]] && echo -e "\t[ Error ]: Flushing query cache failed !!"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user