1. Find mysqldump.exe in the MySQL installation path D:\xxx\MYSQL\MySQL Workbench CE 6.0.8. Since the script execution requires that there should be no spaces in the path (if there are spaces in the path, a 0kb backup file will be generated), copy mysqldump.exe to any folder (here I am D:/Soft/MYSQL) 2. Edit and save the script back_up.bat as follows: @echo off set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%" D:/Soft/MYSQL/mysqldump --opt -u root --password=991446 lslib_test> D:/db_backup/lslib_test_%Ymd%.sql @echo on Note: This method does not require closing the database, and can back up files by name every day. The current date is obtained by combining %date:~5,2%. The effect of the combination is yyyymmdd. The date format obtained by the date command defaults to yyyy-mm-dd (if it is not in this format, you can use the pause command to pause the command line window to view the current computer date format obtained by %date:~,20%). Therefore, %date:~5,2% can be used to get the two characters starting from the fifth character in the date. For example, today is 2009-02-05, and %date:~5,2% can be used to get 02. (The subscript of the date string starts from 0)! 2. Put the script back_up.bat into the Windows execution plan Control Panel -> Search for Scheduled Tasks -> Create Basic Tasks -> Follow your instincts and you can configure it successfully! Replenish: The above method works fine on my local machine, but the same setting on the server is unsuccessful, so I used navicat scheduled tasks to do a scheduled backup. step: 1. Open Navicat, click Backup - New Backup, click Save without using anything, give it a name and close the dialog box. All tables are checked by default in Object Selection. 2. Click Plan -> Create a new batch job -> Double-click the plan you want to select (the plan saved in the previous step) 3. Save the plan (give it a random name) --> click the task to be executed --> set the scheduled task 4. Set the scheduled time and save it. The password you are required to enter is the server password. 5. After success, the scheduled backup will generate a psc file. The default location is C:\Users\Computer Name\Documents\Navicat\MySQL\servers, which can be seen in the backup of the navicat table. 6. You can modify the backup storage location At this time, when I use navicat to extract SQL, I get garbled characters. It is normal to restore the backup directly. QA: The script scheduling task can be done locally but not on the server. Why? Navicat scheduled tasks cannot be done on the local machine, but can be done on the server. Why? Why is there garbled Chinese characters when extracting SQL? UTF-8 and GBK encoding formats don't work either. Why? This is the end of this article about the implementation of scheduled backup in MySQL 5.7. For more information about scheduled backup in MySQL, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Vue template compilation details
>>: Implementation of Docker Compose multi-container deployment
In MySQL, we usually use limit to complete the pa...
Table of contents Preface: Implementation steps: ...
1. Absolute path First of all, on the local compu...
1. What is mycat A completely open source large d...
Problem Description In our projects, horizontal t...
Hello everyone, today I will share with you the W...
Preface The original project was placed on the pu...
This article example shares the specific code of ...
swarm three virtual machines 132,133,134 1. Initi...
Copy code The code is as follows: <input type=...
Optgroup is used in the select tag to make the dro...
Table of contents The difference between hash and...
This article shares the specific code for WeChat ...
Table of contents 1. Usage of keep-alive Example ...
I. Introduction First, let me explain the version...