Mysql tutorial database tutorial definition Automatic Data Backup
MySQL installation path: D: AppServMySQL
Forum Database Name: flow
MySQL root Password 526888
Database Backup destination: F: Databackup
Program code
For/f "Tokens = 1 Delims =/" % I in ('date/t') do set dt = % I
For/f "Tokens = 1" % I in ('time/t') do set tm = % I
Set tm = % dt %
SET bkupdir = F: Databackup
SET mysqldir = D: AppServMySQL
Path D: AppServMySQLbin
SET dbname = flow
SET dbuser = root
SET dbpassword = 526888
SET CharacterSet = utf8
@ ECHO Beginning backup of % dbname %...
Mysqldump-u % dbuser %-p % dbpassword % dbname % -- add-drop-table -- complete-insert -- opt> % bkupdir % dbname %-% tm %. SQL
@ ECHO Done! New file: % bkupdir % dbname %-% tm %. SQL
Save the preceding code as backup_db.bat.
Then, run the script periodically using the "scheduled task" of Windows. (For example, execute back_db.bat at every day)
1. Enable related services.
Open "Control Panel"-"Management Tools" (if you use a new classification view, you must first open "performance and maintenance")-"service", and a table will be displayed, you can find the "Task Scheduler" item in it. If it is "disabled", you need to start the service. The method is to right-click "attribute" and change "disabled" to "Manual" or "automatic" (manual means that you need to start it again when you start the system next time, automatic means that the service is automatically enabled every time the computer is started), and then click the "Start" button under "OK;
2. Ensure permissions and Set passwords and related settings.
If you have to set a boot password for your computer, you cannot set the boot password alone. The specific method is: first set a boot password for your computer (Note: You need to have administrator permissions, otherwise you don't want to use it), and then follow the steps above to open it, the difference is that what we want to open is not a "service" but a "Local Security Policy". After opening it, select "Local Policy" and "Security Options ". Then, find "account: Local Account With Blank Password" in the table on the right. If this item is already "enabled", change it to "disabled ".