centos中mysql備份數(shù)據(jù)庫腳本分享
#!/bin/bash
#backup mysql data
DBDIR=/data/mysql
BACKDIR=/data/bak/mysql
TIME=`date -d "today" +%F`
DB=$(ls -p $DBDIR | grep / |tr -d / | grep -Ev 'information_schema|performance_schema|mysql|test')
/etc/init.d/mysqld stop
if [ -d $BACKDIR ]
then
echo "OK!"
else
mkdir -p $BACKDIR
fi
cd $DBDIR
for i in $DB
do
tar czf $BACKDIR/$i\_db\_$TIME.tar.gz $i
done
/etc/init.d/mysqld start
find $BACKDIR -name "*.tar.gz" -type f -mtime +15 -exec rm {} \; >/dev/null 2>&1
- CentOS7下 MySQL定時自動備份的實(shí)現(xiàn)方法
- CentOS7開啟MySQL8主從備份、每日定時全量備份(推薦)
- CentOS系統(tǒng)下如何設(shè)置mysql每天自動備份
- CentOS下mysql定時備份Shell腳本分享
- CentOS7版本安裝Mysql8.0.20版本數(shù)據(jù)庫的詳細(xì)教程
- CentOS 8.1下搭建LEMP(Linux+Nginx+MySQL+PHP)環(huán)境(教程詳解)
- CentOS7.5 安裝 Mysql8.0.19的教程圖文詳解
- CentOS Mysql數(shù)據(jù)庫如何實(shí)現(xiàn)定時備份
相關(guān)文章
linux多線程編程詳解教程(線程通過信號量實(shí)現(xiàn)通信代碼)
這篇文章主要介紹了linux多線程編程詳解教程,提供線程通過信號量實(shí)現(xiàn)通信的代碼,大家參考使用吧2013-12-12在linux上定期執(zhí)行命令、腳本(cron,crontab,anacron)
在linux下,如果想要在未來的某個時刻執(zhí)行某個任務(wù),并且在未來的每一個這樣的時刻里都要執(zhí)行這個任務(wù)。這篇文章主要介紹了在linux上定期執(zhí)行命令、腳本(cron,crontab,anacron)的相關(guān)知識,需要的朋友可以參考下2018-07-07Linux 編程之進(jìn)程fork()詳解及實(shí)例
這篇文章主要介紹了Linux 編程之進(jìn)程fork()詳解及實(shí)例的相關(guān)資料,需要的朋友可以參考下2017-03-03Shell腳本實(shí)現(xiàn)防止國外ip訪問服務(wù)器
這篇文章主要介紹了Shell腳本實(shí)現(xiàn)防止國外ip訪問服務(wù)器,本文通過分析使用IP地址庫,然后把國外IP指導(dǎo)入iptables并禁止訪問實(shí)現(xiàn),需要的朋友可以參考下2014-12-12