今天遇到要在windows下定制执行数据库的备份
找的方法都是创建bat文件 使用windows定时执行任务执行
内容:
@echo off
set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%"
"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqldump" --opt -u root --password=root scwl > E:\db_backup\scwl_%Ymd%.sql
@echo on
注意:
1.加引号是因为路径中有空格 没有不需要
2.password=root
root是密码
3.scwl是指数据库名称
4.Ymd获取备份时的时间
5.第一个root登录人
定时任务在:
计算机=》属性=》任务管理器=》管理工具=》任务计划程序中
具体创建方法 时光机:
https://jingyan.baidu.com/article/ca00d56c767cfae99febcf73.html