In windows, MYSQL databases are automatically backed up and the backup batch files are automatically cleared.

Source: Internet
Author: User
Tags echo command

Save the following code as aaa. bat

@ Echo off
Echo.
Echo MySQL database backup
Echo *****************************
Echo.
Echo today is % date %
Echo time is % time %
The echo command for deleting folders is rd/s/q d: \ decode.
Echo command to delete all files in the folder is del/s/q d: \ decode
Echo.
Echo *****************************
Rd/s/q D: \ % Ymd % \
Set "Ymd = % date :~, 4% % date :~ 5, 2% % date :~ 8, 2%"
Md "D: \ % Ymd %"
"D: \ Mysql50 \ bin \ mysqldump"-opt-Q-uphpweb3-pphpweb3-default-character-set = utf8 phpweb3> "D: \ % Ymd % \ mySQLteble. SQL"
Echo.
Echo MySQL database backup is complete. Please check...
Echo.
Echo.
Pause
 

The rd/s/q D: \ % Ymd % \ statement is the same as the backup directory. It is automatically cleared and all files in the directory are saved. Then md re-creates the directory. In this way, the backup is cleared automatically.

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.