Automatic MySQL backup

Source: Internet
Author: User
Tags custom name mysql automatic backup mysql backup

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.