ASimpleMySQLDailyBackupScript_MySQL
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了ASimpleMySQLDailyBackupScript_MySQL,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1451字,纯文字阅读大概需要3分钟。
内容图文
![ASimpleMySQLDailyBackupScript_MySQL](/upload/InfoBanner/zyjiaocheng/579/ecf27b60e7a94e51a96f6633ded60531.jpg)
Related MicroZone Resources
Clustrix Whitepapers
INFOGRAPHIC: The Future of the Database
What We Offer: Clustrix Features
Proven in Production: Clustrix Case Studies
Like this piece? Share it with your friends:
|More
Using the MySQL export script I've showed from thelast post(assuming you saved it in a file named "$HOME/database-export.sh"), you may now perform a daily backup with your crontab service like this.
#file: mysql-backups.shDIR=`dirname $0`echo "Backup DB with export script."$DIR/database-export.shecho "Moving exported files into backup dir."DB_BAK_DIR=$HOME/mysql-backups/`date +%a`echo "Removing old file (if exists) and saving new backup into $DB_BAK_DIR"if [[ -e $DB_BAK_DIR ]]; thenrm -fv $DB_BAK_DIR/*elsemkdir -p $DB_BAK_DIRficp -v $DIR/*.sql $DB_BAK_DIR
This script should create a daily folder under your home directory, for example like "$HOME/mysql-backups/Mon", "Tue", "Wed" etc. It should save up to 7 days in a week if you run this with a daily cron job.
# crontab -e@daily $HOME/mysql-backups.sh > /dev/null 2>&1
This is not the most robust way of backing up your DB, but it's a simple solution if you just want something quick up and running without worry too much.
Published at DZone with permission ofZemian Deng, author and DZone MVB. (source)
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)
Tags:- backup
- MySQL
- Tips and Tricks
- SQL
内容总结
以上是互联网集市为您收集整理的ASimpleMySQLDailyBackupScript_MySQL全部内容,希望文章能够帮你解决ASimpleMySQLDailyBackupScript_MySQL所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。