Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql_backup.sh

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

#! / bin/bashpath=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbinexport path# database user name dbuser='1111'# database backup with password dbpasswd='2222'# database backup time BACKUP_TIME= `date + "% Y/%m/%d% H:%M.%S" `backup_time= `date + "% Y%m%d" `# Log backup path logpath='/var / log/mysql_backup' [!-e "$logpath"] & & mkdir $logpath cd $logpath touch mysql_backup.logcd# data backup path datapath='/home/backup/mysql_back' [!-e "$datapath"] & & mkdir $datapath # echo "backup time is ${BACKUP_TIME} Backup database table ${dbname} start "> ${logpath} / mysql_backup.log# official backup database SQLBakName=" ${backup_time} .lxhp.tar.gz "mysqldump-- user=$dbuser-- password=$dbpasswd-- databases $dbname > $datapath/mysql_backup_$ {backup_time} .sqlfind $datapath-type f-mtime + 7-exec rm-rf {}\ > / dev/null 2 > & 1

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report