Use the system crontab to execute backup files regularly and save the backup results by date to achieve the purpose of backup. 1. Create a path to save the backup file /mysqldata#mkdir /mysqldata 2. Create /usr/sbin/bakmysql file#vi /usr/sbin/bakmysql enter rq= date +%Y%m%d tar zcvf /mysqldata/mysql$rq.tar.gz /var/lib/mysql Or written as rq= date +%Y%m%d mysqldump –all-databases -u root -p password > /mysqldata/mysql$rq.sql /var/lib/mysql is the directory where your database files are located. Some users may have /usr/local/mysql/data. This may be different for each user. /mysqldata/ indicates the directory where backup files are saved. Everyone can do this according to their own requirements. 3. Modify the file attributes to make it executable# chmod +x /usr/sbin/bakmysql 4. Modify /etc/crontab#vi /etc/crontab Add below 01 3 * * * root /usr/sbin/bakmysql Indicates that the backup is performed at 3 o'clock every day 5. Restart crond# /etc/rc.d/init.d/crond restart Finish. So every day you can see such files in /mysqldata mysql20040619.tar.gz You can just download it. Well, the above is how to quickly use crontab to schedule backup of MySQL in Linux system. For more information about the use of crontab, please see the following related articles You may also be interested in:
|
<<: js uses FileReader to read local files or blobs
>>: Detailed process of building mongodb and mysql with docker-compose
Today I saw a case study on MySQL IN subquery opt...
1. Problems encountered In the process of distrib...
Preface This article mainly introduces the releva...
1. Image formats supported on the WEB: GIF: can s...
This article example shares the specific code of ...
Preface: When we need to store decimals and have ...
1. Install MySQL software Download and install My...
Input subsystem framework The linux input subsyst...
For the beginner's first installation of MySQ...
Original text: http://www.planabc.net/2008/08/05/...
After installing VMware Tools, ① text can be copi...
SMIL adds support for timing and media synchroniz...
Table of contents 1. Software and system image 2....
<br />I'm basically going crazy with thi...
Prerequisites: Docker is already installed 1. Fin...