windows系统自动备份mysql数据库的方法 mysqldump

1、新建一个backmysql.bat文件

@echo off

set yyyy=%date:~,4%
set mm=%date:~5,2%
set dd=%date:~8,2%
if /i %time:~0,2% lss 10 set hh=0%time:~1,1%
if /i %time:~0,2% geq 10 set hh=%time:~0,2%
set mn=%time:~3,2%
set ss=%time:~6,2%
set date=%yyyy%%mm%%dd%
set time=%hh%%mn%%ss%
set filename=%date%_%time%


"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqldump">mysqldump --opt -P4406 -u root --password=root databasename >E:/DatabaseBackUp/databasename/databasename_%filename%.sql

@echo on
#@pause

2、使用 任务计划程序 导入计划 BackUpMysql.xml



  
    2019-03-21T15:44:44.3029412
    abc\USER001
  
  
    
      2019-03-21T04:00:00
      true
      
        1
      
    
    
      2019-03-22T13:30:00
      true
      
        1
      
    
    
      2019-03-22T10:33:00
      true
      
        1
      
    
  
  
    
      abc\USER001
      Password
      HighestAvailable
    
  
  
    IgnoreNew
    false
    true
    true
    false
    false
    
      true
      false
    
    true
    true
    false
    false
    true
    P3D
    7
  
  
    
      C:\Windows\backmysql.bat
      C:\Windows\
    
  

 

 

你可能感兴趣的:(mysql,windows)