🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.database
Article #106

��3������Mysql��ݿ�

#106
From: Dem����ɫ�н�����
Date: Mon, 15 Feb 2010 01:53
56 lines
2145 bytes
ֻ�谴������3������һ�ж�������ƿ�֮�£�

��һ�����ڷ����������ñ���Ŀ¼
���룺

mkdir /var/lib/mysqlbackup
cd /var/lib/mysqlbackup
�ڶ�������д���ݽű�
���룺

vi dbbackup.sh

ճ�����´��룬��ظ�����е�username,password��dbname��
���룺

#!/bin/sh
 #Username to access the MySQL server
 USERNAME="username"
 # Username to access the MySQL server
 PASSWORD="password"
 # List of DBNAMES for Backup
 DBNAME="dbname"
 #date timestamp for log message
 DATE=`/bin/date +%Y-%m-%d_%Hh%Mm`
 #output file
 OUTDIR="/var/lib/mysqlbackup/"
 OUTFILE="ip_bindass".$DATE."sql.gz"
 #working directory
 DIR="/var/lib/mysqlbackup/"
#cd $DIR
 # MySQL Backup
 /usr/bin/mysqldump --database $DBNAME --opt --single-transaction 
-u$USERNAME -p$PASSWORD | /usr/bin/gzip -9 > $OUTDIR$OUTFILE
��ı��ݽű�Ȩ��

  
���룺

chmod +x dbbackup.sh

������crontab��ʱִ�б��ݽű�
���룺

crontab -e
��ÿ������3��20���ݣ�������´��룬

���룺

20 15 * * * /var/lib/mysqlbackup/dbbackup.sh 


http://article.yeeyan.org/view/50012/84158
--
http://bbs.sjtu.edu.cn/file/comic/122390669464913.jpg

�� ��Դ:����ˮ˼Դ bbs.sjtu.edu.cn��[FROM: 207.46.55.29]
Technical Details
Message-ID: <4kPDLM$bug@bbs.sjtu.edu.cn>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!goblin1!goblin2!goblin.stu.neva.ru!news.neu.edu.cn!news.shec6.edu.cn!SJTU

Show Full Headers
Complete Article Headers
X-Google-Thread: 4df683fd51,83e7203f0bf7507c,start
X-Google-Attributes: gid4df683fd51,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: Chinese,GB
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!goblin1!goblin2!goblin.stu.neva.ru!news.neu.edu.cn!news.shec6.edu.cn!SJTU
From: ZAKU.bbs@bbs.sjtu.edu.cn (Dem����ɫ�н�����)
Newsgroups: cn.bbs.comp.database
Subject: ��3������Mysql��ݿ�
Date: 15 Feb 2010 01:53:23 GMT
Organization: ��ˮ˼Դ
Message-ID: <4kPDLM$bug@bbs.sjtu.edu.cn>
Mime-Version: 1.0
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: 8bit
X-Filename: database/M.1266198790.A