Home  >  Article  >  Database  >  How to realize automatic scheduled backup of mysql database under windows server

How to realize automatic scheduled backup of mysql database under windows server

伊谢尔伦
伊谢尔伦Original
2017-06-28 14:01:393563browse

There are many methods on the Internet about automatic backup of Mysql under window, but few of them are really usable. Some of them are very complicated and difficult to operate. Here is the editor of Script House. We have shared and compiled several software for everyone to use

There are many methods on the Internet about automatic backup of Mysql under windows, but few of them are really usable. Some of them are very complicated and difficult to operate. .

We all know that mssql itself comes with scheduled tasks that can be used for automatic backup. But how can we automatically backup mysql?

Teach you the simplest method.

This method is done using bat batch processing.

Imaginary environment: MySQL Installation Location: D:\Program Files\MySQL\MySQL Server 5.0\data

As shown in the picture:

The database name is: 952game database backup destination: d:\db_bak\ (the path to which disk you want to back up the database to) I If you want to prepare it under the db-bak directory of the D drive================================== Create a new db_bak.bat and write the following code

net stop mysql
xcopy c:\mysql\data\bbs\*.* d:\db_bak\bbs\%date:~0,3%\ /y
net start mysql

Detailed explanation in the picture:

The best step is to implement regular backup, learn from me! GO go go

Here we use the simplest method

Use Windows' "Scheduled Tasks" to execute the batch script regularly. (For example: execute back_db.bat at 3 am every day)

If you don’t know how, please see the picture and text:

1. Run and schedule tasks

2. Add scheduled tasks.

#3. The last step is to specify the backup time.

Now you have completed the automatic scheduled backup, it is very simple.

Finally, the editor will tell you one more thing in the morning: this batch processing command\%date:~0,3% means to extract the day of the week information
Of course, if you want to create the year, month and day, use it %date:~0,10% , the system will create a date directory for you every day. It's very convenient.

%date:~0,10% //Extract the year, month and day information
%date:~-3% //Extract the day of the week information
%time:~ 0,5% //Extract hours and minutes from the time
%time:~0,-3% //Extract hours, minutes and seconds information

Domestic Windows server users can use:

Guardian God backup software free version (sqlserver, automatic file backup)

Please use the platform p8net mysql management tool MyAdmin v1.0 (mysql scheduled backup tool)

The above is the detailed content of How to realize automatic scheduled backup of mysql database under windows server. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn