Principle: Use window Timer task timed cmd load Mytask.bat file, bat run Php.exe program compile run mytask.php file
, which enables the database to be backed up
Mytask.bat
Content:
D:\phpStudy\php53\php.exe D:\www\mytask.php
mytask.php
Content:
$filename =date (' Ymdhis ', Time ());
$command = "D:\phpStudy\MySQL\bin\mysqldump-u root-proot-d sx > d:\dbbak\\{$filename}.sql";
EXEC ($command);
Window Control Panel (test Win8)-Administrative Tools-Task Scheduler-actions-Create task-set general name-New trigger-new action
Several common methods of mysqldump:
(1) Export the entire database (including data in the database)
Mysqldump-u username-p dbname > Dbname.sql
(2) Export database structure (without data)
Mysqldump-u username-p-D dbname > Dbname.sql
(3) Export a data table (containing data) in the database
Mysqldump-u username-p dbname tablename > Tablename.sql
(4) The table structure of a data table in the export database (without data)
Mysqldump-u Username-p-D dbname tablename > Tablename.sql
Window automatic task implementation database scheduled backup