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
Docker download address: http://get.daocloud.io/#...
Install 8.0.13 based on MySQL 6.1.3. MySQL 8.0.13...
Preface In daily development, when we use MySQL t...
If you want the entire interface to have a backgr...
As shown below: Yesterday: UNIX_TIMESTAMP(CAST(SY...
<div class="sideBar"> <div>...
These introduced HTML tags do not necessarily ful...
1.mysql-5.7.19-winx64.zip (this is the free insta...
Error occurs: When exporting the database from My...
This article summarizes the knowledge points of M...
This article describes the VMware virtual machine...
Without going into details, let's go straight...
There are two files a.htm and b.htm. In the same d...
Table of contents Small but beautiful Keep it sim...
Anaconda is the most popular python data science ...