docker mysql 数据库备份
backup.sh
#!/bin/bash
date=`date +%Y%m%d-%H%M%S`
dbpwd="20230101"
dbnames=("db1" "db2")
for dbname in ${dbnames[@]}
do
docker exec mariadb mysqldump -uroot -p${dbpwd} --databases ${dbname} > /data/backup/${dbname}-${date}.sql
done