Liunx scheduled backup mysql task implementation code

  

mysql_bak.sh file content is as follows

#!/bin/bash#/usr/local/mysql/bin/mysqldump -uroot -proot -c --hex- Blob --quick --default-character-set=GB2312 -B xx > /home/bak/db/sql_xx_`date +%y%m%d`.sqlday=`date -d'-7 day' +' %d'`# keeps a 7-day backup and keeps a backup of 1st of each month [ "$day" != "01" ]; thenrm -rf /home/bak/db/sql_bsoa-ezoa_`date -d'-7 day' +'%y%m%d'`.sql

fi

2. Adding timed tasks to liunx

3.to mysql_bak .sh permissions that can be executed



Copyright © Windows knowledge All Rights Reserved