mysql automatic backup under windows

       I haven't blogged for a while, I'm mostly lazy, and I've been very busy some time ago. After all, my life event has been finalized, which is very gratifying. Today the company needs to do mysql automatic backup, so I found a lot of information in Du Niang, and finally realized it. Among them, it is worth noting that why most of the solutions given can not be explained clearly, is it a programmer's habit? Must leave a hole? Or is Guo Degang's pit king driving too much?

       Let's not talk about gossip, see the topic: mysql automatic backup under Windows

       Tools needed: mysql, Windows computer

       step:

 1: First, let's build a bat file and put it in a random folder, but we must remember the location, and it is easy to find, compare a path that needs him, as shown in the figure

 

 2: Content in the bat file:

@echo off

set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%"

"C:/Program Files/MySQL/MySQL Server 5.5/bin/mysqldump" --opt -u root --password=1234 testswjt > D:/db_backup/testswjt_%Ymd%.sql 

@echo on

-u: username

--password: password

-host: address, for example, we are connecting to another server address

D:/db_backup/testswjt_%Ymd%.sql : save the backup address, set by time

Note: The path of mysqldump in mysql must be enclosed in double quotation marks. Many people on the Internet say that there are spaces that need to be enclosed, but there is no need, but when I tested it, I found that this must be enclosed, so that there will be no error , it is recommended to wrap

 3: Set up scheduled tasks on the computer

  I’ll skip it here, I won’t write it down, I’ve found a lot on the Internet, just take a look at the settings in the picture below, and then it will be backed up automatically.



 


 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326088066&siteId=291194637