Add user on mysql LOCK

This commit is contained in:
Dryusdan 2020-02-15 14:28:25 +01:00
parent 12fb790ebe
commit f0bac06551

View file

@ -109,7 +109,7 @@ do
then
warning "${dbname} have a table who using MyISAM engine."
info "Dumping with lock"
mysql -N -e "LOCK TABLES;" ${dbname}
mysql --user=${USERNAME} --password=${PASSWORD} --host=${HOST} --port=${PORT} -N -e "LOCK TABLES;" ${dbname}
for tablename in $(mysql --user=${USERNAME} --password=${PASSWORD} --host=${HOST} --port=${PORT} -N -e "show tables" ${dbname})
do
info "Dumping ${tablename}'s schema of ${dbname}"
@ -118,7 +118,7 @@ do
mysqldump --user=${USERNAME} --password=${PASSWORD} --host=${HOST} --port=${PORT} --no-create-info --extended-insert=FALSE ${dbname} ${tablename} | gzip > ${FOLDER}/datas/${dbname}/${tablename}.sql.gz &
wait
done &
mysql -N -e "UNLOCK TABLES;" ${dbname}
mysql --user=${USERNAME} --password=${PASSWORD} --host=${HOST} --port=${PORT} -N -e "UNLOCK TABLES;" ${dbname}
else
info "Dumping with single transaction"
for tablename in $(mysql --user=${USERNAME} --password=${PASSWORD} --host=${HOST} --port=${PORT} -N -e "show tables" ${dbname})