mysql 5.1ʼþµ÷¶ÈÆ÷²âÊÔ
Î塢ʼþµ÷¶ÈÆ÷²âÊÔ
5.1¡¢²âÊÔÄ¿µÄ
5.1.1 ÅäÖ÷½·¨
5.1.2 ÊÇ·ñÕý³£¹¤×÷
5.1.3 ÈÕ³£µÄά»¤
5.2¡¢Ê¼þµ÷¶ÈÆ÷½éÉÜ
×ÔMySQL5.1.6Æð£¬Ôö¼ÓÁËÒ»¸ö·Ç³£ÓÐÌØÉ«µÄ¹¦ÄÜ
–ʼþµ÷¶ÈÆ÷(Event Scheduler)£¬¿ÉÒÔÓÃ×ö¶¨Ê±Ö´ÐÐijЩÌض¨ÈÎÎñ£¨ÀýÈ磺ɾ³ý
¼Ç¼¡¢¶ÔÊý¾Ý
½øÐлã×ܵȵȣ©£¬À´È¡´úÔÏÈÖ»ÄÜÓɲÙ×÷ϵͳ
µÄ¼Æ»®ÈÎÎñÀ´Ö´ÐеŤ×÷¡£¸üÖµµÃÒ»ÌáµÄÊÇMYSQLµÄʼþµ÷¶ÈÆ÷¿ÉÒÔ¾«È·µ½Ã¿ÃëÖÓÖ´ÐÐÒ»¸öÈÎÎñ£¬¶ø²Ù×÷ϵͳ
µÄ¼Æ»®ÈÎÎñ£¨È磺Linux
쵀CRONȘWindows
ϵÄÈÎÎñ¼Æ»®£©Ö»Äܾ«È·µ½Ã¿·ÖÖÓÖ´ÐÐÒ»´Î¡£¶ÔÓÚһЩ¶ÔÊý¾ÝʵʱÐÔÒªÇó±È½Ï¸ßµÄÓ¦ÓÃ
£¨ÀýÈ磺¹ÉƱ¡¢ÅâÂÊ¡¢±È·ÖµÈ£©¾Í·Ç³£Êʺϡ£
ʼþµ÷¶ÈÆ÷ÓÐʱҲ¿É³ÆΪÁÙʱ´¥·¢Æ÷(temporal triggers)£¬ÒòΪʼþµ÷¶ÈÆ÷ÊÇ»ùÓÚÌض¨Ê±¼ä
ÖÜÆÚ´¥·¢À´Ö´ÐÐijЩÈÎÎñ£¬¶ø´¥·¢Æ÷(Triggers)ÊÇ»ùÓÚij¸ö±íËù²úÉúµÄʼþ´¥·¢µÄ£¬Çø±ðÒ²¾ÍÔÚÕâÀï¡£
ÔÚʹÓÃÕâ¸ö¹¦ÄÜ֮ǰ±ØÐëÈ·±£event_schedulerÒÑ¿ªÆô£¬¿ÉÖ´ÐÐ
SET GLOBAL event_scheduler = 1;
»òÎÒÃÇ¿ÉÒÔÔÚÅäÖÃmy.iniÎļþ
ÖмÓÉÏ event_scheduler = 1»ò
SET GLOBAL event_scheduler = ON;
À´¿ªÆô£¬Ò²¿ÉÒÔÖ±½ÓÔÚÆô¶¯ÃüÁî
¼ÓÉÏ“–event_scheduler=1”£¬ÀýÈ磺
mysql
d ... --event_scheduler=1
Òª²é¿´µ±Ç°ÊÇ·ñÒÑ¿ªÆôʼþµ÷¶ÈÆ÷£¬¿ÉÖ´ÐÐÈçÏÂSQL£º
SHOW VARIABLES LIKE 'event_scheduler';
»ò
SELECT @@event_scheduler;
»ò
ÓµÓÐ SUPER ȨÏÞµÄÕË»§Ö´ÐÐ SHOW PROCESSLIST ¾Í¿ÉÒÔ¿´µ½Õâ¸öÏß³ÌÁË
5.3¡¢¶¨Ê±·þÎñ
ÅäÖÃ
ÏÈÀ´¿´Ò»ÏÂËüµÄÓï·¨£º
CREATE EVENT [IF NOT EXISTS] event_name
ON SCHEDULE schedule
[ON COMPLETION [NOT] PRESERVE]
[ENABLE | DISABLE]
[COMMENT 'comment']
DO sql_statement;
schedule:
AT TIMESTAMP [+ INTERVAL INTERVAL]
| EVERY INTERVAL [STARTS TIMESTAMP] [ENDS TIMESTAMP]
INTERVAL:
quantity {YEAR | QUARTER | MONTH | DAY | HOUR | MINUTE |
WEEK | SECOND | YEAR_MONTH | DAY_HOUR | DAY_MINUTE |
DAY_SECOND | HOUR_MINUTE | HOUR_SECOND | MINUTE_SECOND}
5.3.1ÿÃë²åÈëÒ»Ìõ¼Ç¼µ½Êý¾Ý±í
USE te
Ïà¹ØÎĵµ£º
MySQL ´¥·¢Æ÷¼òµ¥ÊµÀý
1¡¢Óï·¨£º
CREATE TRIGGER <´¥·¢Æ÷Ãû³Æ> --´¥·¢Æ÷±ØÐëÓÐÃû×Ö£¬×î¶à64¸ö×Ö·û£¬¿ÉÄܺóÃæ»á¸½Óзָô·û.ËüºÍMySQLÖÐÆäËû¶ÔÏóµÄÃüÃû·½Ê½»ù±¾ÏàÏó.
{ BEFORE | AFTER } --´¥·¢Æ÷ÓÐÖ´ÐеÄʱ¼äÉèÖ㺿ÉÒÔÉèÖÃΪʼþ·¢ÉúÇ°»òºó¡£
{ INSERT | UPDATE | DELETE } --ͬÑùÒ²ÄÜÉ趨´¥· ......
±¾ÎÄתÔØ×Ô£ºhttp://www.54xue.com/?action-viewnews-itemid-7498
#BEGIN CONFIG INFO
#DESCR: 4GB RAM, ֻʹÓÃInnoDB, ACID, ÉÙÁ¿µÄÁ¬½Ó, ¶ÓÁиºÔØ´ó
#TYPE: SYSTEM
#END CONFIG INFO
#
# ´ËmysqlÅäÖÃÎļþÀý×ÓÕë¶Ô4GÄÚ´æ
# Ö÷ҪʹÓÃINNODB
#´¦Àí¸´ÔÓ¶ÓÁв¢ÇÒÁ¬½ÓÊýÁ¿½ÏÉÙµÄmysql·þÎñÆ÷
#
# ½«´ËÎļþ¸´ÖƵ½/etc/m ......
Èç¹ûÒªËæ»ú»ñÈ¡¼Ç¼Êý£¬ÔÚmysqlÀï×î¼òµ¥µÄ·½·¨¿Ï¶¨ÊÇorder
by
rand
()ÁË£¬µ«ÊÇÕâÖÖ·½·¨Ö»ÄÜÔÚ±í¼Ç¼¼«ÉÙµÄÇé¿öϲÅÄÜʹÓá£Ö÷ÒªÊÇÒòΪorder
by
rand
()µ¼ÖÂÁËusing filesort.Õâ¸öʱºò²éѯÀàÐÍ»á±ä³Éall£¬Ë÷Òý»áʧЧ¡£Ö»Ðè¼òµ¥µÄ±äͨÏ£¬Íê³É¿ÉÒÔ×öµ½Í¬ÑùµÄЧ¹û¡£
¸ù¾Ý¼Ç¼µÄÀàÐÍ£¬·ÖÀàÁ¬ÐøºÍ·ÇÁ¬ÐøÁ½ÖÖ¡£
Á¬ÐøÖ ......
http://www.cnblogs.com/rethink/archive/2009/10/09/1579634.html
mysql cache¹¦ÄÜ·ÖÎö£º
1
mysqlµÄcache¹¦ÄܵÄkeyµÄÉú³ÉÔÀíÊÇ£º°ÑselectÓï¾ä°´ÕÕÒ»¶¨µÄhash¹æÔòÉú³ÉΨһµÄkey£¬selectµÄ½á¹ûÉú³Évalue£¬¼´key=>value¡£ËùÒÔ¶ÔÓÚcache¶øÑÔ£¬selectÓï¾äÊÇÇø·Ö´óСдµÄ£¬Ò²Çø·Ö¿Õ¸ñµÄ¡£Á½¸öselectÓï¾ä±ØÐëÍêÍêÈ«È«Ò»Ö ......
ÔÚWindowsÉÏÔËÐÐMySQLµÄ»·¾³¼°ÖµµÃ×¢Òâ
Ò»¸ö32λWindows²Ù×÷ϵͳ£¬Èç³ð£¬ÎÒ£¬NT£¬2000£¬XP»òWindows Server 2003µÄ¡£
Ó²¼þ»·¾³ÒªÇó²¢²»ÊǺܸßÕâ¾ÍÃâÁË¡£
»ùÓÚWindows NT²Ù×÷ϵͳ£¨ÐĄ̂±Ò£¬2000£¬XP£¬2003Ä꣩£¬ÔÊÐíÄúÔËÐÐ×÷Ϊ·þÎñMySQL·þÎñÆ÷¡£Ò»¸öWindows NTʹÓõIJÙ×÷ϵͳ£¬Ç¿ÁÒ½¨Òé¡£²ÎÔĵÚ2.3.11£¬“Æô¶¯MySQL ......