当前位置:网站首页>MySQL 数据库的自动备份操作
MySQL 数据库的自动备份操作
2022-06-28 02:35:00 【雪中亮】
「博客搬家」 新地址: 简书
MySQL 数据库中,对指定表实现按天自动备份的功能是比较有用的。
1. 预先条件
- 已正确安装 MySQL 并可开机自动运行
- 已将 MySQL 的工具添加到系统的环境变量中。
2. 操作方法
新建批处理文件,其中内容为:
rem *******************************Code Start *****************************
@echo off
mysqldump -u "用户名" --password="密码" "数据库名" > "保存文件绝对地址及保存的文件名"
@echo on
rem ******************************* Code End *****************************
我所配置的 .bat 文件内容为:
rem *******************************Code Start *****************************
@echo off
set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%"
mysqldump -u root --password=lml manager > C:\MySQLBackup\manager_%Ymd%.sql
@echo on
rem ******************************* Code End *****************************
3. 将此 .bat 文件添加到系统计划任务中
打开 “控制面板” -> “计划任务程序” -> “创建基本任务”
可以设置每天固定时间运行一次该 .bat 文件,即可实现每天自动对 MySQL 数据库进行备份
4. 参考资料
边栏推荐
- matlab习题 —— 数据的基本处理
- Notepad++--列编辑模式--用法/实例
- R1 Quick Open Pressure Vessel Operation Special Operation Certificate Examination Library and Answers in 2022
- What is the best and safest software to download when buying stocks?
- 如何编写简洁代码?(上)
- 华为设备WLAN基本业务配置命令
- 简单ELK配置实现生产级别的日志采集和查询实践
- Inference optimization implementation of tensorrt model
- Relative path writing of files
- RichView TRVStyle
猜你喜欢
2022 electrician (elementary) recurrent training question bank and online simulation examination
View the SQL execution plan according to explain and optimize the SQL
A16z:元宇宙解锁游戏基础设施中的新机遇
CURDATE()和NOW()区别
Object class, and__ new__,__ init__,__ setattr__,__ dict__
__ getitem__ And__ setitem__
Build your own website (17)
2022安全员-C证考试题库模拟考试平台操作
17 `bs对象.节点名h3.parent` parents 获取父节点 祖先节点
Single page application (SPA) hash route and historical API route
随机推荐
Flow based depth generation model
RichView TRVStyle TextStyles
crond BAD FILE MODE /etc/cron. d
nn.Parameter和torch.nn.init系列函数给模型参数初始化
空闲中断无法清除
Apache——阿帕奇简介
Brief history and future trend of codeless software
Tardigrade: Trino's solution to ETL scenarios
劲爆!YOLOv6又快又准的目标检测框架开源啦(附源代码下载)
Win 10出现bitlocke恢复,蓝屏错误代码0x1600007e
Necessary software tools in embedded software development
项目实战!手把手教你 Jmeter 性能测试
QEMU monitor usage
JS clear the object and its value:
service实现类里面为何一直报红
Notepad++--常用的插件
Relative path writing of files
2022 safety officer-c certificate examination question bank simulated examination platform operation
apache、iis6、ii7独立ip主机屏蔽限制ip访问
Apache - Introduction à Apache