hosts/scripts/mysql_backup.sh: fix error if saving database mysql ('--lock-tables=0) in case of mariadb.
This commit is contained in:
parent
d57237eec7
commit
7013d8644f
@ -95,12 +95,6 @@ err_Log=${LOCK_DIR}/mysql.err.log
|
||||
# -------------------- Variable --------------------- #
|
||||
#
|
||||
|
||||
if [[ -n ${mysql_version} ]]; then
|
||||
_backupDestArchiveDir="${script_backup_dir}/MySQL-${mysql_version}"
|
||||
else
|
||||
_backupDestArchiveDir="${script_backup_dir}/MySQL"
|
||||
fi
|
||||
|
||||
|
||||
if [ $srcHost != "localhost" ] || $_via_ssh_tunnel ;then
|
||||
mysql=`$ssh ${ssh_user}@$srcHost which mysql`
|
||||
@ -152,6 +146,12 @@ else
|
||||
MYSQL_DISTRIBUTION="MySQL"
|
||||
fi
|
||||
|
||||
if [[ -n ${mysql_version} ]]; then
|
||||
_backupDestArchiveDir="${script_backup_dir}/${MYSQL_DISTRIBUTION}-${mysql_version}"
|
||||
else
|
||||
_backupDestArchiveDir="${script_backup_dir}/${MYSQL_DISTRIBUTION}"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ ! -d $_backupDestArchiveDir ]; then
|
||||
@ -967,6 +967,15 @@ if $ARCHIVE ;then
|
||||
|
||||
mysqldump_flags="--no-data --no-create-info --routines"
|
||||
|
||||
if [ "$i" = "mysql" -a "$MYSQL_DISTRIBUTION" = "MariaDB" ]; then
|
||||
# - prevent from error:
|
||||
# - Error 1556: You can't use locks with log tables
|
||||
# -
|
||||
# - use '--lock-tables=0'
|
||||
# -
|
||||
mysqldump_flags="$mysqldump_flags --lock-tables=0"
|
||||
fi
|
||||
|
||||
info_msg="save functions of database $i.."
|
||||
echononl "\t$info_msg"
|
||||
if [ $srcHost != "localhost" ] || $_via_ssh_tunnel ;then
|
||||
@ -1103,6 +1112,15 @@ if $ARCHIVE ;then
|
||||
mysqldump_flags="$mysqldump_flags --events"
|
||||
fi
|
||||
|
||||
if [ "$i" = "mysql" -a "$MYSQL_DISTRIBUTION" = "MariaDB" ]; then
|
||||
# - prevent from error:
|
||||
# - Error 1556: You can't use locks with log tables
|
||||
# -
|
||||
# - use '--lock-tables=0'
|
||||
# -
|
||||
mysqldump_flags="$mysqldump_flags --events --lock-tables=0"
|
||||
fi
|
||||
|
||||
info_msg="save database $i.."
|
||||
echononl "\t$info_msg"
|
||||
if [ $srcHost != "localhost" ] || $_via_ssh_tunnel ;then
|
||||
|
Loading…
Reference in New Issue
Block a user