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

shell Öе÷Óà mysql ²Ù×÷

#!/bin/bash
#ɾ³ý100¸öÊý¾Ý¿âÖеÄ1000¸ö±íµÄ¹ýÆÚÊý¾Ý
DBHOST="127.0.0.1"
DBPWD="pwd"
DBUSER="root"
MYSQLBIN="/usr/local/mysql/bin/mysql"
for((dbindex = 0;dbindex < 100;dbindex++))
do
   for((tabindex = 0;tabindex < 10;tabindex++))
   do
    if [ $dbindex -lt 10 ]; then
  del="delete from gs_map_0${dbindex}.t_${tabindex}";
    else
  del="delete from gs_map_${dbindex}.t_${tabindex}";
    fi
    del=${del}" where Fcreate_time < UNIX_TIMESTAMP() - 86400"
    bin=`${MYSQLBIN} -u${DBUSER} -p${DBPWD} -h${DBHOST} -e"${del}"`
    $bin
    #echo ${bin} 
    #echo $del >>/tmp/aaa.txt
    sleep 5
   done
done
#crontab configure
# 0 3 * * * clear.sh > /dev/null 2>&1


Ïà¹ØÎĵµ£º

mysqlÖÐÖÐ×Ö·û´®½ØÈ¡º¯Êý

MySQL ×Ö·û´®½ØÈ¡º¯Êý£ºleft(), right(), substring(), substring_index()¡£»¹ÓÐ mid(), substr()¡£ÆäÖУ¬mid(), substr() µÈ¼ÛÓÚ substring() º¯Êý£¬substring() µÄ¹¦Äܷdz£Ç¿´óºÍÁé»î¡£ 1. ×Ö·û´®½ØÈ¡£ºleft(str, length) mysql> select left('sqlstudy.com', 3);+-------------------------+| left('sqlstudy.com', 3) | ......

MySQL±¸·Ý¡¢»¹Ô­

»¹Ô­Ò»¸öÊý¾Ý¿â:mysql -h localhost -u root -p123456 www<c:\www.sql
±¸·ÝÒ»¸öÊý¾Ý¿â:mysqldump -h localhost -u root -p123456 www > d:\www2008-2-26.sql
//ÒÔÏÂÊÇÔÚ³ÌÐòÖнøÐвâÊÔ
//$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile";
$command="mysqldum ......

mysql ʱ¼äº¯Êý

1.DATE_FORMAT('2010-05-15 15:47:36','%H:%i:%s')   ->       ½á¹û£º15:47:36
    ½«ÈÕÆÚ¸ñʽ¸ù¾ÝÌõ¼þ²»Í¬×ª»»³ÉËùÐèÒªµÄÈÕÆÚ¡¢Ê±¼ä¸ñʽ
2.timediff('23:40:00', ' 18:30:00')  ->     ½á¹û£º05:10:00
    ......

MySQL×î»ù´¡ÖªÊ¶¼Ç¼

Ò».°²×°
rpm·½Ê½
rpm -ivf MySQL*
tar·½Ê½
tar xzvf mysql-x.xx.tar.gz
cd mysqlp-x.xx    Éú³Émakefile
./congigure   
make              ±àÒë
 
make install
mysql_install_db
¶þ.Æô¶¯¡¢¹Ø±Õ
ser ......

С̸MySQL×Ö·û¼¯


×÷/ÒëÕߣºÒ¶½ðÈÙ£¨Email: £©£¬À´Ô´£ºhttp://imysql.cn£¬×ªÔØÇë×¢Ã÷×÷/ÒëÕߺͳö´¦£¬²¢ÇÒ²»ÄÜÓÃÓÚÉÌÒµÓÃ;£¬Î¥Õ߱ؾ¿¡£
Ê×ÏÈ,ÕâÆ¬ÎÄÕ´¿´âÊÇÎҵĸöÈ˾­Ñé̸֮,ÊÊÓÃÓÚÎÒ³£¼ûµÄ»·¾³¼°ÏîÄ¿ÖÐ.
¸öÈ˽¨Òé,Êý¾Ý¿â×Ö·û¼¯¾¡Á¿Ê¹ÓÃutf8(HTMLÒ³Ãæ¶ÔÓ¦µÄÊÇutf-8),ÒÔʹÄãµÄÊý¾ÝÄܺÜ˳ÀûµÄʵÏÖÇ¨ÒÆ,ÒòΪutf8×Ö·û¼¯ÊÇĿǰ×îÊʺÏÓÚÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ