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

边栏推荐
- Crawl IP
- Store and guarantee rancher data based on Minio objects
- 6. Functions of C language, why functions are needed, how functions are defined, and the classification of functions
- 1、 Relationship among CPU, memory and hard disk
- Reverse string
- Basic mathematical knowledge (update)
- Find the memory occupied by the structure
- JVM (24) -- performance monitoring and tuning (5) -- Analyzing GC logs
- 【CodeForces】Educational Codeforces Round 132 (Rated for Div. 2)
- Kubeedge releases white paper on cloud native edge computing threat model and security protection technology
猜你喜欢

Advanced notes (Part 2)

Multi-Modal Knowledge Graph Construction and Application: A Survey

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

Quick sort template

Tencent cloud deployment lamp_ Experience of building a station

Const pointer of C language and parameter passing of main function
![[C language] simulation implementation of pow function (recursion)](/img/7b/ef8b3d97adc7810de249a37642c71f.png)
[C language] simulation implementation of pow function (recursion)

软考中级(系统集成项目管理工程师)高频考点
![[C language] Hanoi Tower problem [recursion]](/img/d8/ff66928c2bc2ad906e38a360a8cf94.png)
[C language] Hanoi Tower problem [recursion]

【实验分享】CCIE—BGP反射器实验
随机推荐
In the second half of 2022, the system integration project management engineer certification starts on August 20
Saltstack advanced
lattice
C language - data storage
local/chain/run_ tdnn.sh:
4. Const and difine and the problem of initializing arrays with const and define
[C language] simulation implementation of strlen (recursive and non recursive)
一文读懂如何部署具有外部数据库的高可用 K3s
Return and job management of saltstack
有哪个老哥知道flinksql 日志很大要怎么解决吗
Raspberry pie 3b ffmpeg RTMP streaming
C+ + core programming
[C language] step jumping problem [recursion]
[C language] summary of methods for solving the greatest common divisor
How can Plato obtain premium income through elephant swap in a bear market?
Implementation of strstr in C language
9. Pointer of C language (2) wild pointer, what is wild pointer, and the disadvantages of wild pointer
JVM(二十四) -- 性能监控与调优(五) -- 分析GC日志
C语言数据 3(2)
Array method added in ES6
