window版mysql備份數據

@echo off
::title name
title db_backup
::color is green
COLOR 2
::defined value
set yy=%date:~0,4%html

set mm=%date:~5,2%mysql

set dd=%date:~8,2%sql

if /i %time:~0,2% lss 10 set hh=0%time:~1,1%.net

if /i %time:~0,2% geq 10 set hh=%time:~0,2%htm

set mn=%time:~3,2%blog

set ss=%time:~6,2%get

set date=%yy%%mm%%dd%it

set time=%hh%%mn%%ss%table

set filename=%date%_%time%
::Your source file is exported to the target file.--lock-all-tables is slove it when lockd tables
D:/MySql/bin/mysqldump --lock-all-tables --opt -u root --password=123456 lsst > D:/db_backup/bbs_%filename%.sql
::output content
echo  "backup succeed to %filename%"
pauseclass

保存文件爲*.bat批處理文件,雙擊便可備份sql腳本

參照連接:http://www.javashuo.com/article/p-vjdaftke-gu.html

相關文章
相關標籤/搜索