MySql Data backup script (not original), mysql Data Backup

Source: Internet
Author: User

MySql Data backup script (not original), mysql Data Backup

Create a file xxx. bat with the following content:

@ Echo off
Set hour = % time :~ 0, 2%
If "% time :~ 0% % "=" "set hour = time :~ 1, 1%
Set now = % Date :~ 0, 4% % Date :~ 5, 2% % Date :~ 8, 2% % hour % Time :~ 3,2% % Time :~ 6, 2%
Echo % now %
Set host = server address
Set port = port number
Set user = MySql user name
Set pass = MySql password
Set dbname = Database Name
Set backupfile = path for saving database files (set by yourself) \ % dbname %-% now %. SQL
XXXX (there cannot be spaces in the folder name in the path, usually under the MySql installation path bin) \ mysqldump-h % host %-P % port %-u % user %-p % pass %-c -- add-drop-table % dbname %> % backupfile %
Echo delete files before 90 days
Forfiles/p "path for saving database files"/m *. SQL/d-90/c "cmd/c del @ file/f"

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.