当前位置:网站首页>Windows系统下Mysql数据库定时备份
Windows系统下Mysql数据库定时备份
2022-07-28 18:15:00 【码奴生来只知道前进~】
目录
我们都知道数据是无价,如果不对数据进行备份,相当是让数据在裸跑,一旦服务器出问题,只有哭的份了。下面将介绍mysql数据库的自动备份,大家可根据情况自行选择将备份数据存放在哪里。
1、创建脚本
新建一个txt文件,然后修改后缀名为bat,名称为backupDB.bat
@echo off
set h=%time:~0,2%
set h=%h: =0%
set hhmiss=%date:~0,4%%date:~5,2%%date:~8,2%%h%%time:~3,2%%time:~6,2%
set "folder=%date:~0,4%%date:~5,2%%date:~8,2%"
::自动创建当天文件夹(dbBack这个文件夹需要自行创建)
if not exist D:\dbBack\%folder% (md D:\dbBack\%folder%)
::(mysql路径)\bin\mysqldump --opt -u 数据库账号 -p数据库密码 数据库名称 >输出地址
C:\"Program Files"\MySQL\"MySQL Server 5.7"\bin\mysqldump --opt -uroot -proot tqf_test > D:\dbBack\%folder%\tqf_test_%hhmiss%.sql
@echo on
::正式运行环境把pause去掉,不然cmd黑窗口会一直保留
::pause存放的路径实际情况,可以直接双击bat文件运行,就可以看到数据库备份到当天的文件中
2、创建定时任务执行
2.1 进入计算机管理

2.2 创建任务
2.3 填写触发器和执行任务时间

2.4 添加执行脚本文件

边栏推荐
- 基于 MinIO 对象存储保障 Rancher 数据
- Power Bi 2021 calendar DAX code
- [experiment sharing] CCIE BGP reflector experiment
- Implementation of memcpy in C language
- [C language] random number generation and `include < time. H > 'learning
- C language - question brushing column
- [C language] Gobang game [array and function]
- In the second half of 2022, the system integration project management engineer certification starts on August 20
- C+ + core programming
- Tencent cloud deployment lamp_ Experience of building a station
猜你喜欢

The cloud native programming challenge is hot, with 510000 bonus waiting for you to challenge!

为什么客户支持对SaaS公司很重要?

Tencent cloud deployment lamp_ Experience of building a station

跨区域网络的通信学习静态路由

产品经理访谈 | 第五代验证码的创新与背景

9. Pointer of C language (4) pointer and one-dimensional array, pointer operation

Stories of Party members | Li qingai uses cartoons to drive farmers to increase income and become rich

WUST-CTF2021-re校赛wp

Wust-ctf2021-re school match WP

83.(cesium之家)cesium示例如何运行
随机推荐
[C language] scanf format input and modifier summary
软考中级(系统集成项目管理工程师)高频考点
[C language] print pattern summary
CDGA|工业互联网行业怎么做好数据治理?
Raspberry pie 3b ffmpeg RTMP streaming
Wildcard ssl/tls certificate
C language operators and input and output
C语言数据 3(1)
[C language] initial C language reflection and summary
Richpedia: A Large-Scale, Comprehensive Multi-Modal Knowledge Graph
2. Floating point number, the difference between float and double in C language and how to choose them
New fruit naming (DP is similar to the longest common subsequence)
The privatized instant messaging platform protects the security of enterprise mobile business
熊市下PLATO如何通过Elephant Swap,获得溢价收益?
Raspberry pie creation self start service
3、 Are formal and actual parameters in a programming language variables?
Return and job management of saltstack
9. Pointer of C language (2) wild pointer, what is wild pointer, and the disadvantages of wild pointer
Data system of saltstack
[C language] Hanoi Tower problem [recursion]
