mysql eventµ÷Óô洢¹ý³Ì
mysql event (ÓÃÀ´ÊµÏÖ¶¨Ê±ÈÎÎñ)¡£mysql
´Ó
5.1.16
¿ªÊ¼ÓµÓеÄй¦ÄÜ¡£
ÏÂÃæÎÒдһ¸ö¼òµ¥µÄʾÀý¡£
ÏÈ´´½¨Êý¾Ý¿âºÍÁ½¸ö±í£º
drop database dep;
create database dep;
use dep;
create table aa
(id int AUTO_INCREMENT primary key,
remark varchar(20)
);
create table bb
(id int AUTO_INCREMENT primary key,
remark varchar(20)
);
ÏÈÍùa±íÖвåÈëÊý¾Ý
insert aa values(null,'aa');
insert aa values(null,'bb');
´´½¨´æ´¢¹ý³Ì£¬Æ书ÄÜÊÇ°Ña±íµÄÄÚÈݸ´ÖƵ½b±íÖÐ.
drop PROCEDURE if exists aapro;
create PROCEDURE aapro()
begin
insert into bb (remark) select remark from aa;
commit;
end;
´´½¨mysql event,
´Ó
2010
Äê1
ÔÂ
14
ÈÕ
15
µã
24
·Ö
59
ÃëÆðÿ1·ÖÖÓµ÷ÓÃÒ»´Î
procedure aapro
¡£
drop event if exists aa_event;
create event aa_event
on SCHEDULE
EVERY 1 MINUTE STARTS '2010-01-14 15:24:59'
ON COMPLETION PRESERVE
DO call aapro();
Æð³õÎÒÖ´ÐÐÉÏÃæµÄ
aa_event¡£b±íÖÐһֱûÓÐÊý¾Ý£¬µ¥¶ÀÔËÐд洢¹ý³ÌÏÔʾÓÐÊý¾Ý£¬
ºóΪ²é×ÊÁϲÅÖªµÀûÓÐÆô¶¯mysql event,
Æô¶¯Óï¾ä:set global event_scheduler =1;
ÔÚÔËÐÐaa_event֮ǰÔËÐС£
Ôٴβéѯb±í,¾ÍÓÐÊý¾ÝÁË¡£
Ïà¹ØÎĵµ£º
1.¹Ø¼ü×Ö
auto_increment
2.×ÔÔöÓ÷¨
Àý:
CREATE TABLE animals ( id mediumint not null auto_increment,
name char(30) not null,
primary key (id));
3.¹ØÓÚ×ÔÔö
Q:Ôõô»ñµÃµ±Ç°µÄ×ÔÔöµÄ×î´óÖµ?
A:select @@identity
Q:Ôõô»ñµÃtableµÄµ±Ç°×ÔÔö×î´óÖµ?
A:select max(i ......
×÷Õß: Ф½¨±ò
| ¿ÉÒÔתÔØ, תÔØʱÎñ±ØÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕÂÔʼ³ö´¦
ºÍ×÷ÕßÐÅÏ¢¼°°æȨÉùÃ÷
꿅᣼http://www.xiaojb.com/archives/it/mysqlroot.shtml
Method 1:
ÔÚ/usr/local/mysql/bin/Ï£º
./mysqladmin -u root password ‘new_password’
Ò»°ã°²×°Ê±Óô˷½·¨ÉèÖá£
Method 2:
ÔÚmysql×´ ......
´´½¨Êý¾Ý¿â£ºcreate database Êý¾Ý¿âÃû;
´´½¨±í£ºcreate table ±íÃû £¨ ÁÐÃû Êý¾ÝÀàÐÍ not null... £©;
²é¿´ÏµÍ³ÖÐËùÓеÄÊý¾Ý¿â£ºshow databases;
Ñ¡ÔñÒªÓ¦ÓõÄÊý¾Ý¿â£ºuse Êý¾Ý¿âÃû;
²é¿´Ä³¸öÊý¾Ý¿âϵÄËùÓÐ±í£ºshow tables;
²é¿´±í½á¹¹£ºdesc(describe) ±íÃû;
ÖØÃüÃû±íÃû£ºalter table ±íÃû rename as бíÃû
¸ ......
×òÌì½âÎöÁËdblp.xml£¬´æÈëÊý¾Ý¿â£¬Éú³ÉÁËÈô¸ÉÕÅÁÙʱ±í¡£½ñÌìÉÏÎ磬¶ÔÕâЩÁÙʱ±í½øÐд¦Àí£¬È»ºó´æÈëʵÑéÉè¼ÆµÄ±íÖС£Êý¾Ý¿âµÄÊý¾ÝÁ¿±È½Ï´ó£¬50¶àM£¬80¶àÍòÌõ¼Ç¼¡£Òò¶øÖ´ÐÐsqlʱ£¬¾ÍÓöµ½Á˺ܶàÎÊÌâ¡£
1¡¢È¥³ýÖظ´tuple
Ôʼdblp.xmlÖУ¬Í¬Ò»ÂÛÎĵĴæÔÚ¼¸¸öÍêÈ«ÏàͬµÄ&l ......
¿ÉÒԲ鿴mysqlÎļþĿ¼my.iniÎļþ£¬¿ÉÒÔÕÒµ½ÀàËÆÓÚ
datadir="D:/beeagle/Program Files/MySQL/MySQL Server 5.0/Data/"µÄ×Ö¶Î
¸Ã·¾¶Îªmysql dataĿ¼
ĬÈÏÔÚ£º"C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\Data\"
×¢Ò⣺Application DataÎļþ¼ÐÊÇÒþ²ØµÄ£¡£¡£¡
¿ÉÒÔÐÞ¸ÄÉÏÊöÅäÖ㬠......