超级强悍的mysql自动备份脚本

八月 8th, 2010 Posted in mysql | 阅读次数: 690 次

Author:gaojinbo

Time:2010-8-8

经过数月的使用,觉得非常好,是备份mysql数据库的利器,特与大家分享!

这个工具使用gpl协议,项目地址:http://sourceforge.net/projects/automysqlbackup/

 

一、如何使用

1.下载最新的备份脚本

点这里下载

 

 

2.修改脚本配置部分

vi  /root/automysqlbackup-2.5.1-01.sh

USERNAME=root
PASSWORD=gaojinbo
BACKUPDIR="/www/backup/db"
MAILADDR="admin@gaojinbo.com"

 

 

3.设置每天晚上3点半自动备份mysql

crontab  -e

30 03 * * * /root/automysqlbackup-2.5.1-01.sh

 

 

4.增加执行权限

chmod +x /root/automysqlbackup-2.5.1-01.sh

 

 

5.安装postfix,备份日志会自动发送到上面指定的邮箱

yum install potfix

 

完成!

相关日志:

Tags:

12 Responses to “超级强悍的mysql自动备份脚本”

  1. ucfinder Says:

    正在下载中,很期待这种功能,本地通过网络备份上传到邮箱???

    马上试下先,文件才19M。


  2. ucfinder Says:

    有没有中文版的教程,或者相关介绍。


  3. ucfinder Says:

    唉啊,很不明白啊。可能是点广告,下载了一个GNU。。。用什么去运行这个automysqlbackup-2.5.1-01.sh
    能在XP里使用这个功能吗?需要什么软件的支持,烦请指教。


  4. gaojinbo Says:

    本地通过网络备份上传到邮箱?不会上传sql备份数据到邮箱,只会发送备份日志到邮箱,可以自己写脚本实现这个功能。

    xp不能使用这个sh备份脚本!


  5. wensheng Says:

    默认安装了sendmail,没安装 postfix,可以发邮件吗?

    Available Packages
    Name : postfix
    Arch : i386
    Epoch : 2
    Version : 2.3.3
    Release : 2.1.el5_2
    Size : 3.6 M
    Repo : base
    Summary : Postfix Mail Transport Agent
    URL : http://www.postfix.org
    License : IBM Public License
    Description: Postfix is a Mail Transport Agent (MTA), supporting LDAP, SMTP AUTH (SASL),
    : TLS

    Name : sendmail
    Arch : i386
    Version : 8.13.8
    Release : 8.el5
    Size : 1.3 M
    Repo : installed
    Summary : A widely used Mail Transport Agent (MTA).
    License : Sendmail
    Description: The Sendmail program is a very widely used Mail Transport Agent (MTA).
    : MTAs send mail from one machine to another. Sendmail is not a client
    : program, which you use to read your email. Sendmail is a
    : behind-the-scenes program which actually moves your email over
    : networks or the Internet to where you want it to go.
    :
    : If you ever need to reconfigure Sendmail, you will also need to have
    : the sendmail.cf package installed. If you need documentation on
    : Sendmail, you can install the sendmail-doc package.


  6. wensheng Says:

    我正在使用的脚本是这个,自己实现,分享一下

    #!/bin/sh
    # Script name : auto_mysql_dump.sh
    # Backup the dbname database
    root=”/backups”
    dir=`date +%Y-%m-%d`
    dbname=”test”
    if [ -d $root ]; then
    mkdir -p $root/$dir
    mysqldump -B –user=root –password=123456 –host=127.0.0.1 $dbname > $root/$dir/$dbname.sql
    if [ $?=0 ]; then
    #Bzip2 the dump.sql
    #bzip2 -z9v $root/$dir/$dbname.sql
    cd $root/$dir
    tar zcvf $dbname.tar.gz $dbname.sql
    #Remove the dump.sql from disk
    rm -f $root/$dir/$dbname.sql
    fi
    fi
    # End of script auto_mysql_dump.sh
    ~


  7. admin Says:

    默认安装了sendmail,没安装 postfix,可以发邮件!


  8. admin Says:


  9. leopku Says:

    最后一步为了发邮件而装postfix有点大动干戈
    卖瓜一下:console下通过smtp发送邮件的工具——SendmailViaSMTP
    http://www.himysql.com/python/sending-mail-through-smtp-server-under-console.html
    仅仅一个.py文件,跨平台,跨架构,支持gmail,可以直接从命令行运行,也可以在shell里调用
    写这个工具的初衷就是为了解决很多服务器发送报警、报告等邮件的问题


  10. how to delete cookies on mac safari Says:

    [...]We Like to Honor it by Linking to it from Our Blog. Here is a Quality Page You Might Find Interesting that we Encourage You to Check[...]…


  11. public smtp server name Says:

    public smtp server relay…

    超级强悍的mysql自动备份脚本 | 高进波博客 – 零起点一步配置你的linux服务器,linux博客,linux教程,web架构…


  12. Microsoft Office Enterprise Says:

    Microsoft Office Enterprise…

    [...]高进波博客 – 零起点一步配置你的linux服务器,linux博客,linux教程,web架构 » Blog Archive » 超级强悍的mysql自动备份脚本[...]…


留下您的脚印