数据库备份
<!-- window bat-->
c: cd "C:\Program Files\MySQL\MySQL Server 8.0\bin" set "Ymd=%date:~0,4%%date:~5,2%%date:~8" mysqldump -h127.0.0.1 -u root -p root hanwhallot hanwhallot >C:\Users\Administrator\Desktop\backup\hanwhallot-%Ymd%.sql
<!-- linux sh-->
<!-- --column-statistics=0 可删除-->
host="localhost" db1=xxdb db2=xxdb backup_path="/data/hanhua/java/backup" times=$(date +%Y%m%d) [ ! -d $backup_path ] && mkdir -p $backup_path cd $backup_path /usr/local/mysql/bin/mysqldump --column-statistics=0 -h$host -uroot -p8MjPNd6Mk2NXtjBY $db1 > $db1"-"$times.sql /usr/local/mysql/bin/mysqldump --column-statistics=0 -h$host -uroot -p8MjPNd6Mk2NXtjBY $db2 > $db2"-"$times.sql