@@ -537,12 +537,12 @@
fi
# IO redirection for logging.
+mkdir -p ${BACKUPDIR} # create backup target directory.
touch ${LOGFILE}
exec 6>&1 # Link file descriptor #6 with stdout.
# Saves stdout.
exec > ${LOGFILE} # stdout replaced with file ${LOGFILE}.
-mkdir -p ${BACKUPDIR} # create backup target directory
touch ${LOGERR}
exec 7>&2 # Link file descriptor #7 with stderr.
# Saves stderr.
@@ -601,7 +601,7 @@
information_schema) OPT="${OPT} --skip-lock-tables" ;;
performance_schema) OPT="${OPT} --skip-lock-tables --skip-events" ;;
esac
- ${MYSQLDUMP} --user=${USERNAME} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --host=${DBHOST} --port=${DBPORT} ${OPT} ${1} > ${2}
+ ${MYSQLDUMP} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --user=${USERNAME} --host=${DBHOST} --port=${DBPORT} ${OPT} ${1} > ${2}
return $?
}
@@ -616,12 +616,12 @@
if [ "$COMP" = "gzip" ]; then
${ECHO} Backup Information for "${1}.gz"
SUFFIX=".gz"
- ${MYSQLDUMP} --user=${USERNAME} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --host=${DBHOST} --port=${DBPORT} ${OPT} ${1} | ${GZIP} > ${2}${SUFFIX}
+ ${MYSQLDUMP} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --user=${USERNAME} --host=${DBHOST} --port=${DBPORT} ${OPT} ${1} | ${GZIP} > ${2}${SUFFIX}
${GZIP} -l "$1.gz"
elif [ "$COMP" = "bzip2" ]; then
${ECHO} Compression information for "${1}.bz2"
SUFFIX=".bz2"
- ${MYSQLDUMP} --user=${USERNAME} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --host=${DBHOST} --port=${DBPORT} ${OPT} ${1} | ${BZIP2} -v 2>&1 > ${2}${SUFFIX}
+ ${MYSQLDUMP} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --user=${USERNAME} --host=${DBHOST} --port=${DBPORT} ${OPT} ${1} | ${BZIP2} -v 2>&1 > ${2}${SUFFIX}
else
${ECHO} "No compression option set, check advanced settings"
fi
@@ -639,7 +639,7 @@
information_schema) OPT="${OPT} --skip-lock-tables" ;;
performance_schema) OPT="${OPT} --skip-lock-tables --skip-events" ;;
esac
- ${MYSQLDUMP} --user=${USERNAME} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --host=${DBHOST} --port=${DBPORT} ${OPT} ${1} ${2} > ${3}
+ ${MYSQLDUMP} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --user=${USERNAME} --host=${DBHOST} --port=${DBPORT} ${OPT} ${1} ${2} > ${3}
return $?
}
@@ -659,12 +659,12 @@
echo
echo Backup Information for "$3.gz"
SUFFIX=".gz"
- ${MYSQLDUMP} --user=${USERNAME} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --host=${DBHOST} --port=${DBPORT} ${OPT} ${1} ${2} | ${GZIP} > ${3}${SUFFIX}
+ ${MYSQLDUMP} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --user=${USERNAME} --host=${DBHOST} --port=${DBPORT} ${OPT} ${1} ${2} | ${GZIP} > ${3}${SUFFIX}
${GZIP} -l "${3}.gz"
elif [ "${COMP}" = "bzip2" ]; then
echo Compression information for "${3}.bz2"
SUFFIX=".bz2"
- ${MYSQLDUMP} --user=${USERNAME} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --host=${DBHOST} --port=${DBPORT} ${OPT} ${1} ${2} | ${BZIP2} -v 2>&1 > ${3}${SUFFIX}
+ ${MYSQLDUMP} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --user=${USERNAME} --host=${DBHOST} --port=${DBPORT} ${OPT} ${1} ${2} | ${BZIP2} -v 2>&1 > ${3}${SUFFIX}
else
[ "${COMP}" = "no" ] || ${ECHO} "No compression option set, check advanced settings"
fi
@@ -733,7 +733,7 @@
# If backing up all DBs on the server
if [ "${DBNAMES}" = "all" ]; then
- DBNAMES="`${MYSQL} --user=${USERNAME} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --host=${DBHOST} --port=${DBPORT} --batch --skip-column-names -e "show databases"| ${SED} 's/ /%/g'`"
+ DBNAMES="`${MYSQL} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --user=${USERNAME} --host=${DBHOST} --port=${DBPORT} --batch --skip-column-names -e "show databases"| ${SED} 's/ /%/g'`"
# If DBs are excluded
for exclude in ${DBEXCLUDE}
@@ -775,7 +775,7 @@
if [ "${PERTABLE}" = "yes" ]; # Check backup per table
then # Start Monthly DB backup per table
echo Monthly Backup of ${MDB} per table...
- TABLES="`${MYSQL} --user=${USERNAME} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --host=${DBHOST} --port=${DBPORT} --batch --skip-column-names -e "show tables" ${MDB} | ${SED} 's/ /%/g'`"
+ TABLES="`${MYSQL} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --user=${USERNAME} --host=${DBHOST} --port=${DBPORT} --batch --skip-column-names -e "show tables" ${MDB} | ${SED} 's/ /%/g'`"
for TABLE in $TABLES
do
if [ ! -e "${BACKUPDIR}/monthly/${MDB}_pertable/${MDB}_pertable_${DATE}.${M}.${MDB}" ] # Check Monthly DB per table Directory exists.
@@ -851,7 +851,7 @@
then
mkdir -p "$BACKUPDIR/weekly/${DB}_pertable/${DB}_pertable.week.$W.$DATE"
fi
- TABLES="`${MYSQL} --user=${USERNAME} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --host=${DBHOST} --port=${DBPORT} --batch --skip-column-names -e "show tables" ${DB} | ${SED} 's/ /%/g'`"
+ TABLES="`${MYSQL} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --user=${USERNAME} --host=${DBHOST} --port=${DBPORT} --batch --skip-column-names -e "show tables" ${DB} | ${SED} 's/ /%/g'`"
for TABLE in ${TABLES}
do
if [ "$PIPECOMP" = "yes" ]; then
@@ -901,7 +901,7 @@
then
mkdir -p "$BACKUPDIR/daily/${DB}_pertable/${DB}_pertable_$DATE.$DOW"
fi
- TABLES="`${MYSQL} --user=${USERNAME} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --host=${DBHOST} --port=${DBPORT} --batch --skip-column-names -e "show tables" ${DB} | ${SED} 's/ /%/g'`"
+ TABLES="`${MYSQL} --defaults-extra-file=<(echo $'[client]\npassword='${PASSWORD}) --user=${USERNAME} --host=${DBHOST} --port=${DBPORT} --batch --skip-column-names -e "show tables" ${DB} | ${SED} 's/ /%/g'`"
for TABLE in ${TABLES}
do
if [ "$PIPECOMP" = "yes" ]; then
|