We use the Windows system's scheduled tasks to implement the database backup, 1, is the folder copy to a fixed folder, 2. is a folder copy to the day of the automatically generated folder:
1: Our company to do a "daily statistics offline film" application, I first put this function into a WinForm program to generate an EXE file
2: "Start-> program-> attachment-> System Tool" find it, open the Scheduled Tasks window
3: Double-click the Add Scheduled Tasks item to start the Scheduled Task wizard
4: Select the application to execute, here we choose to have the "statistics every day offline movie" function exe file
5: Enter the task name, you can use the default name or take a name you like, select the way the task is executed, we choose the "daily" item
6: Set the task start time and date, the default is the current time and date, we will start time to 9:00, that is, we work time
7: A new task is added to the Scheduled Tasks window by clicking the Finish button
Let's take a look at how the backup was first recorded. To copy the following lines of code into a. bat file (except in parentheses), execute the file on a daily schedule of execution.
Copy Code code as follows:
C:\WINDOWS\system32\xcopy Z:\b-b-car.com d:\b-b-car.combak/y/e
(Y:\ replacement is not required to confirm,
Copy Code code as follows:
Set mmdd=%date:\~0,4%%date:\~5,2%%date:\~8,2%
C:\WINDOWS\system32\xcopy Z:\b-b-car.com D:\b-b-car.combak%mmdd%/d/y/e
(d:\ directory f:\ file y:\ replace without confirmation, e:\ copy all files)
The automatic backup database can be used with the following commands, note that the database must have a password, because there is no password to be confirmed once, can not achieve the effect of automatic backup
Copy Code code as follows:
Set mmdd=%date:\~0,4%%date:\~5,2%%date:\~8,2%
mysqldump-h192.168.1.46-ulinhaiquan-p123456 db_bbcar > D:\b-b-car.combak\databases\DB_Bbcar_ "%mmdd:=%" ". SQL"