Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

mysql ¶¨Ê±Êý¾Ý±¸·Ý

1.±àдshell½Å±¾
vi /data/www/project_name/bin/mysql_backup.sh
#!/bin/bash
#This is a ShellScript For Auto DB Backup
#Powered by liuzheng

#ϵͳ±äÁ¿¶¨Òå
DBName=test
DBUser=root
DBPasswd=123456
BackupPath=/tmp/mysql_backup/

NewFile="$BackupPath"db$(date +%y%m%d).tar.gz
DumpFile="$BackupPath"db$(date +%y%m%d).sql
OldFile="$BackupPath"db$(date +%y%m%d --date='1 days ago').tar.gz


#´´½¨±¸·ÝÎļþ
if [ ! -d $BackupPath ]; then
mkdir $BackupPath
fi

echo "---------------------------"
echo $(date +"%y-%m-%d %H:%M:%S")
echo "---------------------------"

#ɾ³ýÀúÊ·Îļþ
if [ -f $OldFile ]; then
¡¡¡¡rm -f $OldFile >> $LogFile
¡¡echo "[$OldFile]Delete Old File Success!"
else
echo "not exist old file!"
fi

#ÐÂÎļþ
if [ -f $NewFile ]; then
echo "[$NewFile] The Backup File is exists,Can't Backup! "
else
mysqldump -u $DBUser -p $DBPasswd $DBName > $DumpFile
tar czvf $NewFile $DumpFile
rm -rf $DumpFile
echo "[$NewFile]Backup Success!"
fi

2.¼Ó½øcrontab -e
#ÿÌìÔçÉÏ6µã¶¨Ê±±¸·ÝÒ»´Î
* 6 * * * /letv/app/php-5.2.6-fastcgi/bin/php-cgi /data/www/project_name/bin/mysql_backup.sh


Ïà¹ØÎĵµ£º

mysql³£ÓÃÖ¸ÁºÏ


Java´úÂë
mysql> select version(),current_date;   
²éѯmysqlµÄ°æ±¾ºÅ ºÍ  ÈÕÆÚ   
mysql> select version();   
²éѯmysqlµÄ°æ±¾ºÅ   
select now();   
²éѯµ±Ç°ÈÕÆÚºÍ׼ȷµÄʱ¼ä  
Java ......

MysqlÈÎÎñµ÷¶È£¨Event£©

<!-- [if gte mso 10]>
MySQL5.1.x
°æ±¾ÖÐÒýÈëÁËÒ»ÏîÐÂÌØÐÔ
EVENT
£¬¹ËÃû˼Òå¾ÍÊÇʼþ¡¢¶¨Ê±ÈÎÎñ»úÖÆ£¬ÔÚÖ¸¶¨µÄʱ¼äµ¥ÔªÄÚÖ´ÐÐÌØ¶¨µÄÈÎÎñ£¬Òò´Ë½ñºóһЩ¶ÔÊý¾Ý¶¨Ê±ÐÔ²Ù×÷²»ÔÙÒÀÀµÍⲿ³ÌÐò£¬¶øÖ±½ÓʹÓÃÊý¾Ý¿â±¾ÉíÌṩµÄ¹¦ÄÜ¡£´Ë¹¦ÄÜÊǶÔ
Oracle
µÄ
Job/Schedule
µÄÄ£·Â£¬
5.1.X
°æ±¾ÒÔÉϲÅÖ§³Ö¡£
 & ......

mysql unionÓï·¨

Ò» UNIONÓï·¨
´úÂë ¸´ÖÆ´úÂë
SELECT ...   
UNION [ALL | DISTINCT]   
SELECT ...   
[UNION [ALL | DISTINCT]   
SELECT ...]  
SELECT ... UNION [ALL | DISTINCT] SELECT ... [UNION [ALL | DISTINCT] SELECT ...]
UNIONÓÃÓÚ°Ñ ......

LinuxÏÂMySQL5.1µÄ°²×°

×î½üÏëÔÚ·þÎñÆ÷ÉÏÊÔÊÔMySQL5.1µÄ·ÖÇø£¬ÓÚÊǾÍÏë×Å×°¸öMySQL5.1£¬¾­¹ýÍ´¿àµÄÒ»¶Î¾­Àúºó£¬ÖÕÓÚÕÒ¸öÏÂÃæ×°¸öºÜºÃµÄ½Ì³Ì£¬ÌûÉÏÀ´±¸Íü¡£
1¡¢MySQLÃâ°²×°°æ/¶þ½øÖưæÈí¼þ£¬²»ÓñàÒ룬ÏÂÔØµØÖ·£º
     http://dev.mysql.com/downloads/
     Îļþ¸ñʽ£ºMYSQL-VERSION-OS.tar.gz
2¡¢´ ......

MySQLÓëÊÂÎñ


×÷ÕߣºÀÏÍõ
MySQL5.X¶¼ÒѾ­·¢²¼ºÃ¾ÃÁË£¬µ«ÊÇ»¹ÓкܶàÈËÈÏΪMySQLÊDz»Ö§³ÖÊÂÎñ´¦ÀíµÄ£¬Õâ²»µÃ²»¹ÖËûÃÇÊǹª¹ÑÎŵ쬯äʵ£¬Ö»ÒªÄãµÄMySQL°æ±¾Ö§³ÖBDB»òInnoDB±íÀàÐÍ£¬ÄÇôÄãµÄMySQL¾Í¾ßÓÐÊÂÎñ´¦ÀíµÄÄÜÁ¦¡£ÕâÀïÃæ£¬ÓÖÒÔInnoDB±íÀàÐÍÓõÄ×î¶à£¬ËäÈ»ºóÀ´·¢ÉúÁËÖîÈçOracleÊÕ¹ºInnoDBµÈÁîMySQL²»Ë¬µÄÊÂÇ飬µ«ÄÇЩÉÌÒµÉϵĶ·ÕùÓ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ