MySQL automatic backup:
Home page, you need to create a backup storage directory. For example, D: \ data \ db_bak \ database folder (the same name as the database is recommended for identification)
Find the folder where the database file is located. For example, D: \ mysqldata \ database folder
Create a BAT file under the backup directory with a custom name, such as the db_back_aa.bat file. Enter the following code (change it to your actual directory)
Net stop MySQL
Xcopy data \ db_bak \ database Folder \ *. * D: \ mysqldata \ database Folder \ % Date :~ 0, 10% \/y
C: \ progra ~ 1 \ WinRAR a-k-r-s D: \ mysqldata \ database Folder \ % Date :~ 0, 102.16.rar D: \ mysqldata \ database Folder \ % Date :~ 0, 10% \
Rd D: \ mysqldata \ database Folder \ % Date :~ 0, 10% \/S/Q
Net start MySQL
Note:
Net stop MySQL stands for stopping MySQL
Xcopy D: \ mysqldata \ database Folder \ *. * D: \ mysqldata \ database Folder \ % Date :~ \/Y: copy the directory file to the backup directory and name it by date.
C: \ progra ~ 1 \ WinRAR a-k-r-s D: \ mysqldata \ database Folder \ % Date :~ 0, 102.16.rar D: \ mysqldata \ database Folder \ % Date :~ 0, 10% \ compresses the copied directory.
Rd D: \ mysqldata \ database Folder \ % Date :~ % \/S/Q Delete the temporary directory and keep the compressed file
. Net start MySQL to enable the Service.
Save the BAT file.
Open the task plan (START-Program-attachment-System Tools-task plan, add the task plan), put the bat in it, and set the execution cycle and when to execute it.