MySQL installation Location: D:\Program files\mysql\mysql Server 5.0\data
The database name is: 952game database backup destination: d:\db_bak\ (the path of the disk you want to back up the database to) I'd like to have the Db-bak directory on the D-Disk ============================ new Db_ Bak.bat, write the following code
My database Address
I backed up the file address:
My Db-bak.dat file
net stop MySQL
xcopy "E:\Server\mysql\MySQL Server 5.0\data\bbsdata\*.*" "e:\icchinabackup\bbsdata\%date:~0,10%\"/e/y/I
net start MySQL
%date:~0,10% get the current date my is 2014\12\5 my backup date
Simple description of the use of Xcopy
xcopy Meta Directory destination directory
/e (Copy all directories and subdirectories and the files in them)
/y (directly overwriting an existing file without prompting)
/I (if the target does not exist and you want to copy multiple files, assume the target must be a directory)
If you do not add the/I parameter, when the target directory, the specified folder does not exist, there will be a corresponding prompt (the content is: file or directory), using this parameter is the default directory.
If you want to learn more about the use of the Xcopy command, type it under cmd:
xcopy/? To view
Detailed
The best step is to realize how to regularly backup, with me to learn! Go Go Go
Here we take the simplest approach
Use the Windows Scheduled tasks to execute the batch script at timed intervals. (ex: Daily 3 o'clock in the morning execution of Back_db.bat)
If not, please read the text:
First, Windows Server 2008 differs greatly from the other server operating systems and Windows Server 2003, where the name of the scheduled task is "Task Scheduler" not in Control Panel, but in "Administrative Tools".
Because the server needs to do some tasks, timed execution, their own program bar, trouble, so the use of bat to replace the operation, a lot of people on the network say every minute to do how to configure, today we will configure.
Open Task Scheduler – click on "Task Scheduler Library" and in the right you will see "Create basic Task" and "Create task" in the action item:
After clicking "Create Task": fill in the appropriate name and check the necessary conditions
Select the "Trigger" option, click "New", create task Execution time, "Repeat task Interval" after the choice, there is time to choose, is hourly, or every minute, you can choose to modify the time , and then determine.
Again to configure the need to perform the "action" is to select the program or BAT file, it is important that the configuration is to select the bat file, in the "Start from (optional)" Here must fill in the corresponding execution program or BAT file directory, otherwise, the execution is unsuccessful.
Special note: I almost cheated, think that Windows scheduled task is not accurate to the minute level, mainly see "repeat Interval (P)" to the right there is no "1 minutes" option, as shown in:
In fact, it can manually modify the time value in addition to the drop-down selection, such as "1 minutes" above!!!
Once added, the added scheduled tasks appear in the list bar.
Use Scheduled Tasks in Windows Server 2012 and 2008 to periodically perform a bat batch file to periodically back up MySQL data