Windows universal mysql database backup script

Source: Internet
Author: User
Tags mysql backup

In mysql, the most common method to back up a database is to copy a database. Let's take a look at the two mysql backup methods implemented by windows batch processing, which is very easy to use.

1. mysql mysqldump + bat processes files

Execute the mysql database backup script (bat file content)

The Code is as follows: Copy code
@ Echo off
Set host = localhost
Set username = root
Set passward = ansure
Set database = weihe
Set backup_path = D: \ db_backup \
Echo "Mysql Backup, please waitting"
Mysqldump-h % host %-u % username %-p % passward % -- skip-lock-tables % database %> % backup_path % \ % database % _ % date :~ 0, 10%. SQL
Echo "OK! "


2. xcopy: Create a batch file backup. dat and enter the following code:

The Code is as follows: Copy code

Net stop mysql
Xcopy "C: \ Program Files \ MySQL Server 5.0 \ data \ piaoyi \ *. *" D: \ db_backup \ % date :~ 0, 10% \/y
Net start mysql

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.