Use crontab, the system is scheduled to back up the mysql database every day

xiaoxiao2021-03-06  47

B48123C

Use crontab, the system of regular daily backup mysql database: Xu Qingfeng 2004-10-13 10:37:38 blog China (Blogchina.com) systems use crontab to regularly perform backup files, backup by date save the results, achieve the purpose of backup . 1. Create a path / mysqldata # mkdir / mysqldata # mkdir / mysqldata 2, create / usr / sbin / bakmysql file #vi / usr / sbin / Bakmysql input RQ = `Date % Y% M% D` Tar Zcvf / MySQLDATA / MySQL $ rq.tar.gz / var / lib / mysql or written RQ = `Date % Y% M% D` mysqldump --all-catabases-u root -P password> /Mysqldata/mysql $rq.sql / var / lib / mysql is a directory of your database file. Some users are / usr / local / mysql / data, each may differ from / mysqldata / represent the directory of the backup file, each person can do it according to your own requirements. 3, modify the file attribute, make it executable # chmod x / usr / sbin / bakmysql 4, modify / etc / crontab # vi / etc / crontab Add 01 3 * * Root / USR / SBIN / BAKMYSQL representation 3 o'clock Perform backup 5, restart crred # /etc/rc.d/init.d/crond restart is completed. This way you can see this file mysql20040619.tar.gz can be downloaded every day in / mysqldata.

转载请注明原文地址:https://www.9cbs.com/read-87471.html

New Post(0)