Automatic mysql database backup for scheduled tasks in windows

Source: Internet
Author: User

The precondition is that you need to have the server control permission, so that we can use the cmd command and windows scheduled task to implement timed execution of the bat batch file we wrote to back up mysql database files.

First, we wrote a. bat file for processing. The Code is as follows:

The Code is as follows: Copy code

Net stop mysql

Xcopy D: phpStudyMySQLdataabc *. * D: up % date :~ 0, 10%/y

Net start mysql

Note: abc is the name of your database, and up is the name you want to back up to the specified directory. Later, the date reference is the directory generation date, for example, up.

Now we have written the batch processing file and started to plan the task.

1. Find it in "start-> Program-> attachment-> System Tools" on windows and open the "scheduled task" window.


2. Find the path of your a. bat file.


3. The execution cycle can be selected below. Here we select daily.


4. Enter the specific time point, which can be accurate to minutes. A logon password for the computer will be entered later. Try to enter the password. Otherwise, the backup will fail, you cannot back up the data without a password.


5. KO is finished.

Related Article

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.