參考來源
---
程式碼:--------------------------------------------------------------------------------
Dim fName,tNow,CMD
tNow = Now()
fName = Year(tNow) & FormatNumber(Month(tNow)/100,2,false) & FormatNumber(Day(tNow)/100,2,false) & FormatDateTime(tNow,3)
fName = Replace(Replace(fName,".",""),":","")
CMD = ""
CMD = CMD & "c:" & vbCrLf
CMD = CMD & "cd c:\mysql\bin" & vbCrLf
CMD = CMD & "mysqldump -u root -p""password"" vbb>d:\bbsbak\backup" & fName & ".sql"
Dim FileObject,BatFile,BatPath
Set FileObject = CreateObject("Scripting.FileSystemObject")
BatPath = "d:\bbsbak\backup.bat"
Set BatFile = FileObject.CreateTextFile(BatPath, True)
BatFile.WriteLine(CMD)
BatFile.Close
Set BatFile = Nothing
Set FileObject = Nothing
Set WshShell = CreateObject("Wscript.Shell")
WshShell.Run BatPath,1,true
Set WshShell = Nothing
--------------------------------------------------------------------------------
把以上程式碼存為backup.vbs,然後你用windows內已含有計劃工作來實現制作備份就行
--opt
制作備份的時候要加上這個參數.....恢復的時候就方便了...對比一下產生的dump文件就會發現增加了那些了...
恢復很簡單...
mysql -u root -p dbname
然後會提示你密碼...
沒有留言:
張貼留言