1. Backup database (single table backup) bk_table.bat
CopyCode The Code is 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 (restoring a single table) Restore. bat Copy codeThe Code is 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
336620.data warehouse and automatically compress it into a. rar file (single table backup) bk_table.bat Copy codeThe Code is 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, 102.16.rar D: \ db_backup \ *. SQL
Del D: \ db_backup \ *. SQL
Pause
After the batch processing, your backup data script will be compressed to the db_bak_date.rar file on your computer D: \ db_backup.
If 'winrar 'is not an internal or external command, it cannot be run.ProgramOr batch files ." Error: Go to computer> Properties> advanced> environment variable> In Path
Add your WinRAR path, such as c: \ Program Files \ WinRAR.
4. Back up the data of the entire database Copy codeThe Code is as follows: mysqldump-h127.0.0.1-p3306-uroot-proot database1> database1. SQL
Pause
Note:
1. Open notepad-> copy the above script to notepad-> save it as the *. BAT file, and double-click it to open and execute it.
2. You need to add the path of your MySQL installation bin directory to the path of the computer environment variable:
Computer-> properties-> advanced-> environment variable-> Add your MySQL installation bin directory path in path, for example, 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 for execution.
All of the above have been tested ~