当前位置:网站首页>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 添加执行脚本文件

边栏推荐
- 有哪个老哥知道flinksql 日志很大要怎么解决吗
- Reverse string
- 跨区域网络的通信学习静态路由
- Richpedia: A Large-Scale, Comprehensive Multi-Modal Knowledge Graph
- The cloud native programming challenge is hot, with 510000 bonus waiting for you to challenge!
- MySQL command statement (personal summary)
- [C language] Pointer advanced knowledge points
- WPF--实现WebSocket服务端
- Store and guarantee rancher data based on Minio objects
- 7. Functions of C language, function definitions and the order of function calls, how to declare functions, prime examples, formal parameters and arguments, and how to write a function well
猜你喜欢

Raspberry pie 4B parsing PWM

How to use pycharm to quickly create a flask project
![最大交换[贪心思想&单调栈实现]](/img/ad/8f0914f23648f37e1d1ce69086fd2e.png)
最大交换[贪心思想&单调栈实现]

How to automatically store email attachments in SharePoint

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

C language - data storage

Multi-Modal Knowledge Graph Construction and Application: A Survey

Store and guarantee rancher data based on Minio objects

WUST-CTF2021-re校赛wp

Prometheus deployment
随机推荐
Raspberry pie 4B parsing PWM
Circular linked list OJ question
[C language] step jumping problem [recursion]
Intermediate soft test (system integration project management engineer) high frequency test site
Longest Palindromic Substring
ssm中项目异常处理
Can China make a breakthrough in the future development of the meta universe and occupy the highland?
C language - control statement
Digital filter design matlab
Power Bi 2021 calendar DAX code
Use of strtok and strError
[C language] summary of methods for solving the greatest common divisor
Raspberry pie 3b ffmpeg RTMP streaming
[C language] shutdown game [loop and switch statement]
HSETNX KEY_ Name field value usage
plt. What does it mean when linestyle, marker, color equals none in plot()
Solve the kangaroo crossing problem (DP)
C language operators and input and output
[experiment sharing] CCIE BGP reflector experiment
C language function
