Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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 ROOTÃÜÂë

1¡¢±à¼­MySQLÅäÖÃÎļþ£º
windows»·¾³ÖУº%MySQL_installdir%\my.ini¡¡//Ò»°ãÔÚMySQL°²×°Ä¿Â¼ÏÂÓÐmy.ini¼´MySQLµÄÅäÖÃÎļþ¡£
linux»·¾³ÖУº/etc/my.cnf
ÔÚ[MySQLd]ÅäÖöÎÌí¼ÓÈçÏÂÒ»ÐУº
skip-grant-tables
±£´æÍ˳ö±à¼­¡£
2¡¢È»ºóÖØÆôMySQL·þÎñ
windows»·¾³ÖУº
net stop MySQL
net start MySQL
linux»·¾³ÖУº
/e ......

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 ......

wampÈçºÎÐÞ¸ÄmysqlĬÈÏ¿ÕÃÜÂë

cmdÏÂÇл»µ½ mysql °²×°Ä¿Â¼
Àý
d:/mysql/bin   (Èç¹ûÓÃWAMP°²×°ÔòÊÇD:\wamp\bin\mysql\mysql5.1.30\bin)
ǰÌ᣺mysqlÓû§rootÃÜÂëΪ¿Õ.
ÊäÈë mysql -u root mysql
mysql> ״̬ÏÂÊäÈë   update user set password=password('ÐÂÃÜÂë') where user='root';
»ØÏÔ   
Query OK, 0 rows ......

mysqlÃüÁîÐв»Ö´ÐкÍÃüÁîÐÐÖÐÎÄÂÒÂëµÄ½â¾ö


1£ºMysql ÃüÁî²»¿ÉÒÔÖ´ÐÐ
Ô­Òò £ººÇºÇ ±ÈÈç show databases µÄÃüÁî £¬Ö´ÐÐÍêÖ®ºó ɶҲûÓÐ £¬×Ðϸ ÕÒÁËÔ­Òò £¬Oh my god  ÉÙÁË ·ÖºÅ¡£
Ӧд³É£ºshow databases;
2£ºÃüÁîÐÐÖÐÎÄÂÒÂëÎÊÌâ
ÏÖÏó£ºmysqlµÄĬÈϱàÂëÉèÖÃΪutf-8£¬Ò³ÃæÒÔutf-8µÄ±àÂ뷽ʽдÈëµ½Êý¾Ý¿â¡£Óù¤¾ß²é¿´Ò»ÇÐÕý³££¬µ«´ÓmysqlµÄÃüÁîÐжÁÊý¾Ý³öÀ´× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ