mysql 备份 bat

MySQL备份

 

新建 bakup.bat 文件

然后编辑文件 输入以下信息:

@echo off
CD D:
if not exist 'databackup'  mkdir D:\databackup备份目录
set CURDATE=%date:~0,4%%date:~5,2%%date:~8,2%
set CURTIME=%time:~0,2%
set CURSEC=%time:~3,2%%time:~6,2%
if "%CURTIME%"==" 0" set CURTIME=00
if "%CURTIME%"==" 1" set CURTIME=01
if "%CURTIME%"==" 2" set CURTIME=02
if "%CURTIME%"==" 3" set CURTIME=03
if "%CURTIME%"==" 4" set CURTIME=04
if "%CURTIME%"==" 5" set CURTIME=05
if "%CURTIME%"==" 6" set CURTIME=06
if "%CURTIME%"==" 7" set CURTIME=07
if "%CURTIME%"==" 8" set CURTIME=08
if "%CURTIME%"==" 9" set CURTIME=09
set CURDT=%CURDATE%%CURTIME%%CURSEC%
"C:\Program Files\MySQL\MySQL Server 5.1\bin"\mysqldump  -u root帐号--password=密码  dbname数据库名 >D:\databackup\%CURDT%.sql

  

 

 

你可能感兴趣的:(sql,C++,c,mysql,SQL Server)