1. Backup Database (single table backup) Bk_table.bat
Copy Code code as follows:
Mysqldump-h127.0.0.1-p3306-uroot-proot--default-character-set=gbk-t database1 Table1>table1.sql
Mysqldump-h127.0.0.1-p3306-uroot-proot--default-character-set=gbk-t Database2 Table2>table2.sql
Mysqldump-h127.0.0.1-p3306-uroot-proot--default-character-set=gbk-t Database2 Table3>table3.sql
Pause
2, restore the database (a single table restore) Restore.bat
Copy Code code as follows:
Mysql-h127.0.0.1-p3306-uroot-proot Database1 < Table1.sql
Mysql-h127.0.0.1-p3306-uroot-proot Database2 < Table2.sql
Mysql-h127.0.0.1-p3306-uroot-proot Database2 < Table3.sql
Pause
3. Backup the database and automatically pack and compress it into a. rar file (a single table backup) Bk_table.bat
Copy Code code as follows:
Mysqldump-h127.0.0.1-p3306-uroot-proot--default-character-set=gbk-t database1 Table1>table1.sql
Mysqldump-h127.0.0.1-p3306-uroot-proot--default-character-set=gbk-t Database2 Table2>table2.sql
Mysqldump-h127.0.0.1-p3306-uroot-proot--default-character-set=gbk-t Database2 Table3>table3.sql
WinRAR a Db_bak_%date:~0,10%.rar d:\db_backup\*.sql
DEL D:\db_backup\*.sql
Pause
After the batch process is executed, your backup data script is compressed into the Db_bak_ date. rar file of your computer D:\DB_Backup.
If "' WinRAR ' is not an internal or external command, it is not a running program or a batch file. "Error, in computer-> properties-> Advanced-> environment variable-> in path item
Add your WinRAR path, such as: C:\Program Files\winrar.
4, back up the entire library of data
Copy Code code as follows:
Mysqldump-h127.0.0.1-p3306-uroot-proot database1 > Database1.sql
Pause
Description
1, open Notepad-> the above script copy to Notepad-> Save as *.bat file can double-click to open execution.
2, need to add your MySQL installation bin directory path to the computer environment variable path:
Computer-> Properties-> Advanced-> environment variable-> add your MySQL Installation bin directory path in path entry: C:\Program files\mysql\mysql Server 5.0\bin
or copy the batch file to the Bin directory C:\Program files\mysql\mysql Server 5.0\bin execution.
All of these have been tested, O (∩_∩) o~