Example of mysql automatic Incremental Backup (local backup and remote backup). If you need it, refer
Example of mysql automatic Incremental Backup (local backup and remote backup). If you need it, refer
1. Local backup
Compile an automatic backup script:
Vim/var/lib/mysql/autobak
The content is as follows:
The Code is as follows:
Cd/data/home/mysqlbak
Rq = 'date + % Y % m % d'
/Usr/local/mysql/bin/mysqldump sqldb -- flush-logs-uroot-p123456 -- opt> 777city _ $ rq. SQL
Save and exit.
Chmod-777/var/lib/mysql/autobak
Crontab-e
00 00 ***/var/lib/mysql/autobak
The autobak script is automatically executed every morning.
/Etc/init. d/crontab restart
Manually execute the script to check the effect.
./Var/lib/mysql/autobak
Ls/data/home/mysqlbak
View the file size
Du-sh/data/home/mysqlbak/777city11. SQL
2. Remote database backup
Remote backup command:
The Code is as follows:
/Usr/local/mysql/bin/mysqldump sqldb -- flush-logs-uroot-p '000000'-H' 10. 241.92.172 '-- opt>/root/777city22. SQL
Automatic Remote Backup:
Back up the mysql database of an ip: 172 server on a machine with ip: 67
Perform operations on machines with ip Address: 67:
1. Compile an automatic backup script:
Vim/var/lib/mysql/autobak
The content is as follows:
The Code is as follows:
Cd/data/home/mysqlbak
Rq = 'date + % Y % m % d'
/Usr/local/mysql/bin/mysqldump sqldb -- flush-logs-uroot-p '000000'-H' 10. 241.92.172 '-- opt> 777city _ $ rq. SQL
Save and exit.
Chmod-R 777/var/lib/mysql/autobak
Crontab-e
00 00 ***/var/lib/mysql/autobak
The autobak script is automatically executed every morning.
/Etc/init. d/crontab restart
Manually execute the script to check the effect.
/Var/lib/mysql/autobak
Ls/data/home/mysqlbak
View the file size
Du-sh/data/home/mysqlbak/777city11. SQL