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
Ïà¹ØÎĵµ£º
¹Ø¼ü×Ö£º GreenSQL Sphinx phpMyAdmin MySQLÄÚºË Êý¾Ý¿â°²È«ÅäÖÃ
±¾ÎÄÖ÷Òª½éÉÜmysqlÊý¾Ý¿âÏÂshowÃüÁîµÄÖ÷ÒªÓ÷¨
¡¡¡¡a. show tables»òshow tables from database_name; -- ÏÔʾµ±Ç°Êý¾Ý¿âÖÐËùÓбíµÄÃû³Æ¡£
¡¡¡¡b. show databases; -- ÏÔʾmysqlÖÐËùÓÐÊý¾Ý¿âµÄÃû³Æ¡£
¡¡¡¡c. show columns from table_name from data ......
/**********************by garcon1986***************************************/
´íÎó´úÂëÈçÏ£º
#1045 - Access denied for user 'root'@'localhost' (using password: YES)
$cd /etc/mysql
$mysql -u root -p
³öÏÖ´íÎó#1045
³¢ÊÔÁ˺ܶ෽·¨ºó£¬ÔÚÍøÂçÉÏÕÒµ½Á˽â¾ö·½·¨¡£
$cd /etc/mysql
$gedit debian.cnf
ÕÒµ½ ......
ÏÔʾ¡¢ÉèÖÃ×Ô¶¯Ìá½» show variable like 'autocommit' set autocommit=1 or 0
ÉèÖÃÈÕÖ¾£º
ÔÚ/etc/mysql/my.cnfÖÐÉèÖÃÈçÏ¿ÉÔÙslow.logÖÐÊä³öÔËÐÐʱ¼ä³¬¹ýÒ»ÃëµÄsqlÓï¾ä
[mysqld]
log-slow-queries = /tmp/slow.log
long_query_time = 1
ÉèÖÃÈÕÖ¾Êä³öÔËÐг¬¹ý1ÃëµÄsqlÓï¾ä set global long_query_ti ......
query_cache_min_res_unit ²éѯ»º´æ·ÖÅäµÄ×îС¿éµÄ´óС(×Ö½Ú)
query_alloc_block_size Ϊ²éѯ·ÖÎöºÍÖ´Ðйý³ÌÖд´½¨µÄ¶ÔÏó·ÖÅäµÄÄÚ´æ¿é´óС
Qcache_free_blocks´ú±íÄÚ´æ×ÔÓÉ¿éµÄ¶àÉÙ£¬·´Ó³ÁËÄÚ´æË鯬µÄÇé¿ö
==========================
1£©µ±²éѯ½øÐеÄʱºò£¬Mysql°Ñ²éѯ½á¹û±£´æÔÚqurey ......
×÷/ÒëÕߣºÒ¶½ðÈÙ£¨Email: £©£¬À´Ô´£ºhttp://imysql.cn£¬×ªÔØÇë×¢Ã÷×÷/ÒëÕߺͳö´¦£¬²¢ÇÒ²»ÄÜÓÃÓÚÉÌÒµÓÃ;£¬Î¥Õ߱ؾ¿¡£
Ê×ÏÈ,ÕâÆ¬ÎÄÕ´¿´âÊÇÎҵĸöÈ˾Ñé̸֮,ÊÊÓÃÓÚÎÒ³£¼ûµÄ»·¾³¼°ÏîÄ¿ÖÐ.
¸öÈ˽¨Òé,Êý¾Ý¿â×Ö·û¼¯¾¡Á¿Ê¹ÓÃutf8(HTMLÒ³Ãæ¶ÔÓ¦µÄÊÇutf-8),ÒÔʹÄãµÄÊý¾ÝÄܺÜ˳ÀûµÄʵÏÖÇ¨ÒÆ,ÒòΪutf8×Ö·û¼¯ÊÇĿǰ×îÊʺÏÓÚÊ ......