Get the App
SLTechnology News&Howtos  ›  Database  › 

Script code for MySQL incremental backup

Shulou Source: shulou.com Published: 2022-05-31 17:54:06 11月07日 Update

This article mainly explains "MySQL incremental backup script code", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's train of thought slowly in depth, together to study and learn "MySQL incremental backup script code"!

#! / bin/sh#author RuM#date 2015-07-10BAKDIR=/tmp/mysqlbakBAKDIR_FULL=$BAKDIR/fullBAKDIR_ADD=$BAKDIR/addCONF=/etc/my.cnfPASSWD=123456INNOBACKUPEX=/usr/bin/innobackupex# will make a full and additional backup for the first execution Later, incremental backup if [- f "$INNOBACKUPEX"] then if [- d "$BAKDIR"] then echo "is ok" else mkdir $BAKDIR_FULL-p mkdir $BAKDIR_ADD-p fi#### full files= `ls $BAKDIR_ FULL` if [- z "$files"] then $INNOBACKUPEX-defaults-file=$CONF-user=root-password=$PASSWD $BAKDIR_FULL FULLNAME=$ (dir "$BAKDIR_FULL") $INNOBACKUPEX-- defaults-file=$CONF-- user=root-- password=$PASSWD-- incremental-basedir=$BAKDIR_FULL/$FULLNAME/-- incremental $BAKDIR_ADD else#### incremental backup ADDNAME=$ (ls-lt $BAKDIR_ADD | sed-n 2p | awk'{print $9}') $INNOBACKUPEX-- defaults-file=$CONF-- user=root-- password=$PASSWD-- incremental-basedir=$BAKDIR_ADD/$ADDNAME/-incremental $BAKDIR_ADD fi else echo "is not install innobackupex" fi thank you for reading The above is the content of "script code for MySQL incremental backup". After the study of this article, I believe you have a deeper understanding of the script code for MySQL incremental backup, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Increments backups code scripts learning content complete that is ideas situations articles more knowledge knowledge points the first time articles guilds follow questions practice Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Microsoft Apple Redmi Linux