windows:
@echo off
d:
cd D:\MySQL\MySQL Server 5.7\bin mysqldump --no-defaults -u用户名 -p密码 -h host(ip地址)数据库名>保存路径\数据库名_%date:~0,4%-%date:~5,2%-%date:~8,2%.sql
@echo on
例如:mysqldump --no-defaults -uroot -p123456 -h 110.110.110.110 mytest>F:\%date:~0,4%%date:~5,2%%date:~8,2%.sql
linux:
/data/mysql/bin/mysqldump-uroot -p123456 -h 110.110.110.110 mytest > /data/dbback/`date +%Y%m%d`.sql