MySQL automatic backup (Windows)

Source: Internet
Author: User
Tags mysql automatic backup

Many times, for data security, our MySQL database needs to be backed up on a regular basis, and here are two ways to automate backup under Windows:

1. Copy the date folder backup

============================ Example Environment:mysql   installation location: c: \mysql Forum database name is Cm_ DB database backup destination: C:\db_bak============================ new Db_bak. bat, write the following code
MySQL xcopy C: \mysql\data\cm_db\*.* c:\db_bak\cm_db\%date: ~0,10%\/S/   MySQL

Then use Windows to schedule tasks to perform db_bak.bat regularly

2. mysqldump Backup to SQL file

============== Example Environment:mysql   installation location: c: \mysql Forum database name is cm_dbMySQL root   Password: 123456 database backup destination: D: \db_backup\
@echo"ymd=%date:~,4%%date:~5,2%%date:~8,2%"C: \MySQL\bin\mysqldump--opt -U root--password=123456 cm_db > D:\db_backup\bbs_%Ymd%. sql@ Echo on

Then use Windows to schedule tasks to perform db_bak.bat regularly

MySQL automatic backup (Windows)

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.