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

mysql 5.0´æ´¢¹ý³Ìѧϰ×ܽá

mysql 5.0´æ´¢¹ý³Ìѧϰ×ܽá
Ò».´´½¨´æ´¢¹ý³Ì
1.»ù±¾Óï·¨£º
create procedure sp_name()
begin
………
end
2.²ÎÊý´«µÝ
¶þ.µ÷Óô洢¹ý³Ì
1.»ù±¾Óï·¨£ºcall sp_name()
×¢Ò⣺´æ´¢¹ý³ÌÃû³ÆºóÃæ±ØÐë¼ÓÀ¨ºÅ£¬ÄÄŸô洢¹ý³ÌûÓвÎÊý´«µÝ
Èý.ɾ³ý´æ´¢¹ý³Ì
1.»ù±¾Óï·¨£º
drop procedure sp_name//
2.×¢ÒâÊÂÏî
(1)²»ÄÜÔÚÒ»¸ö´æ´¢¹ý³ÌÖÐɾ³ýÁíÒ»¸ö´æ´¢¹ý³Ì£¬Ö»Äܵ÷ÓÃÁíÒ»¸ö´æ´¢¹ý³Ì
ËÄ.Çø¿é£¬Ìõ¼þ£¬Ñ­»·
1.Çø¿é¶¨Ò壬³£ÓÃ
begin
……
end;
Ò²¿ÉÒÔ¸øÇø¿éÆð±ðÃû£¬È磺
lable:begin
………..
end lable;
¿ÉÒÔÓÃleave lable;Ìø³öÇø¿é£¬Ö´ÐÐÇø¿éÒÔºóµÄ´úÂë
2.Ìõ¼þÓï¾ä
if Ìõ¼þ then
statement
else
statement
end if;
3.Ñ­»·Óï¾ä
(1).whileÑ­»·
[label:] WHILE expression DO

statements

END WHILE [label] ;
(2).loopÑ­»·
[label:] LOOP

statements

END LOOP [label];
(3).repeat untilÑ­»·
[label:] REPEAT

statements

UNTIL expression

END REPEAT [label] ;
Îå.ÆäËû³£ÓÃÃüÁî
1.show procedure status
ÏÔʾÊý¾Ý¿âÖÐËùÓд洢µÄ´æ´¢¹ý³Ì»ù±¾ÐÅÏ¢£¬°üÀ¨ËùÊôÊý¾Ý¿â£¬´æ´¢¹ý³ÌÃû³Æ£¬´´½¨Ê±¼äµÈ
2.show create procedure sp_name
ÏÔʾijһ¸ö´æ´¢¹ý³ÌµÄÏêϸÐÅÏ¢
mysql´æ´¢¹ý³ÌÖÐÒªÓõ½µÄÔËËã·û
mysql´æ´¢¹ý³Ìѧϰ×ܽᣭ²Ù×÷·û
ËãÊõÔËËã·û
+     ¼Ó   SET var1=2+2;       4
-     ¼õ   SET var2=3-2;       1
*     ³Ë   SET var3=3*2;       6
/     ³ý   SET var4=10/3;      3.3333
DIV   Õû³ý SET var5=10 DIV 3;  3
%     È¡Ä£ SET var6=10%3 ;     1
±È½ÏÔËËã·û
>            ´óÓÚ 1>2 False
<            СÓÚ 2<1 False
<=           СÓÚµÈÓÚ 2<=2 True
>= &nb


Ïà¹ØÎĵµ£º

mysqlÏà¹Ø

ÏÔʾ¡¢ÉèÖÃ×Ô¶¯Ìá½» 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 ......

С̸MySQL×Ö·û¼¯


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

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


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

mysql»ù±¾ÃüÁî

mysql »ù±¾ÃüÁî
µÚÒ»ÕС¢mysql·þÎñµÄÆô¶¯ºÍÍ£Ö¹
net stop mysql
net start mysql
µÚ¶þÕС¢µÇ½mysql
Óï·¨ÈçÏ£º mysql -uÓû§Ãû -pÓû§ÃÜÂë
¼üÈëÃüÁîmysql -uroot -p£¬ »Ø³µºóÌáʾÄãÊäÈëÃÜÂ룬ÊäÈë12345£¬È»ºó»Ø³µ¼´¿É½øÈëµ½mysqlÖÐÁË£¬mysqlµÄÌáʾ·ûÊÇ£º
mysql>
×¢Ò⣬Èç¹ûÊÇÁ¬½Óµ½ÁíÍâµÄ»úÆ÷ÉÏ£¬ÔòÐèÒª ......

ÓÅ»¯MySQLÊý¾Ý¿âÐÔÄܵļ¸¸öºÃ·½·¨

1¡¢Ñ¡È¡×îÊÊÓõÄ×Ö¶ÎÊôÐÔ
¡¡¡¡MySQL¿ÉÒԺܺõÄÖ§³Ö´óÊý¾ÝÁ¿µÄ´æÈ¡£¬µ«ÊÇÒ»°ã˵À´£¬Êý¾Ý¿âÖеıíԽС£¬ÔÚËüÉÏÃæÖ´ÐеIJéѯҲ¾Í»áÔ½¿ì¡£Òò´Ë£¬ÔÚ´´½¨±íµÄʱºò£¬ÎªÁË»ñµÃ¸üºÃµÄÐÔÄÜ£¬ÎÒÃÇ¿ÉÒÔ½«±íÖÐ×ֶεĿí¶ÈÉèµÃ¾¡¿ÉÄÜС¡£ÀýÈ磬ÔÚ¶¨ÒåÓÊÕþ±àÂëÕâ¸ö×Ö¶Îʱ£¬Èç¹û½«ÆäÉèÖÃΪCHAR(255),ÏÔÈ»¸øÊý¾Ý¿âÔö¼ÓÁ˲»±ØÒªµÄ¿Õ¼ä£¬ÉõÖÁÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ