1 .#! Binsh2.cdhomemysql-backup3.rmalldb.5.tar.gz-f4.mvalldb.4.tar.gzalldb.5.tar.gzdevnull215.mvalldb.3.tar.gzalldb.4.tar.gzdevnull216.mvalldb.2.tar.gzalldb.3.tar.gz devnull217.mvalldb. 1 1 .#! /Bin/sh
2. cd/home/mysql-backup
3. rm alldb.5.tar.gz-f
4. mv alldb.4.tar.gz alldb.5.tar.gz>/dev/null 2> & 1
5. mv alldb.3.tar.gz alldb.4.tar.gz>/dev/null 2> & 1
6. mv alldb.2.tar.gz alldb.3.tar.gz>/dev/null 2> & 1
7. mv alldb.1.tar.gz alldb.2.tar.gz>/dev/null 2> & 1
8. mv alldb.0.tar.gz alldb.1.tar.gz>/dev/null 2> & 1
9. tar zcf alldb.0.tar.gz alldb. SQL>/dev/null 2> & 1
10. rm alldb. SQL-f
11. mysqldump-all-databases-opt-ppassword> alldb. SQL
In the last sentence above-the password of ppassword indicates the password of the root account. change it to the password of the root account of your own database, alternatively, you can create a backup user to replace the root account. In addition, make sure that the/home/mysql-backup directory exists. Finally, change the script attribute to 755, and the owner is root. root, put it in/etc/cron. in the daily directory, you can back up the database once a day and cycle it every week. If dual-Machine backup is added, the system is more secure.
The same method can be used to back up website content and dns databases.