Using crontab, the system regularly backs up mysql Databases every day and uses the system crontab to regularly execute backup files. The backup results are saved by date for backup purposes.
1. Create the path to save the backup file/mysqldata # mkdir/mysqldata www.2cto.com 2. Create the/usr/sbin/bakmysql file # vi/usr/sbin/bakmysql and enter rq = 'date + % Y % m % d 'tar zcvf/mysqldata/mysql1_rq.tar.gz/var/lib/mysql or write rq = 'date + % Y % m % d' mysqldump -- all-databases-u root -p password>/mysqldata/mysql $ rq. SQL/var/lib/mysql is the directory of your database files. Some users are/usr/local/mysql/data. Each user may be different./mysqldata/indicates the directory where the backup files are saved, this individual can also do it according to their own requirements. 3. Modify file attributes, make it executable # chmod + x/usr/sbin/bakmysql 4. Modify/etc/crontab # vi/etc/crontab and add www.2cto.com 01 3 *** root/usr/sbin /bakmysql indicates that the backup is performed at three o'clock every day. 5. Restart crond #/etc/rc. d/init. d/crond restart is complete. In this way, you can see this file "mysql20040619.tar.gz" in "/mysqldata" every day. You can download it directly. Author: xiahuawuyu