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

MySQL´æ´¢¹ý³Ìѧϰ


http://www.mysql.cn/
ÊÂÎñ£¬²ÎÊý£¬Ç¶Ì×µ÷Óã¬Óα꣬ѭ»·, ´¥·¢Æ÷£¬ÊÓͼ£¬Ô¼Êø, Ë÷Òý£¬¡£¡£¡£
1. ´´½¨ÊµÀýÊý¾Ý¿â
   create database db5;
   use db5;
2.´´½¨Ò»¸ö¼òµ¥µÄ¹¤×÷±í,²¢²åÈëÊý¾Ý
   create table t(s1 int);
   insert into t values(5);
3.´´½¨³ÌÐòʵÀý create procedure Example
   create procedure p1() select * from t;
      SQLÓï¾ä´æ´¢¹ý³ÌµÄµÚÒ»²¿·ÖÊÇ create procedure
      µÚ¶þ²¿·ÖÊǹý³ÌÃû£ºÉÏÃæд洢¹ý³ÌµÄÃû×ÖÊÇp1¡£
      µÚÈý²¿·ÖÊé²ÎÊýÁÐ±í£¨£©£¬µÚËIJ¿·ÖÊdzÌÐòµÄÖ÷Ì壬“select * from t”
*****ʲôÑùµÄMySQLÓï¾äÔÚ´æ´¢¹ý³ÌÌåÖÐÊǺϷ¨µÄ£¿
       ÔÚ´æ´¢¹ý³ÌÌåÖпÉÒÔ°üº¬ËùÓеĺϷ¨SQLÊý¾Ý¿â¶¨ÒåÓïÑÔ£¬insert£¬update,delete,drop,create,replaceµÈµÈÓï¾ä
°üÀ¨£¨set£¬commit£¬rollback£©µ«ÊÇ£¬ÔÚ´úÂëÖÐÈç¹û°üº¬MYSQLµÄÀ©³ä¹¦ÄÜ£¬ÄÇô´úÂ뽫²»ÄÜÒÆÖ²¡£
   
4. µ÷Óô洢¹ý³Ì£¬ËùÐèÒªÊäÈëµÄ¾ÍÊÇcallºÍÄã¹ý³ÌÃûÒÔ¼°Ò»¸öÀ¨ºÅ¡£
    call p1();
5.¹ý³ÌÖеÄÌØÕ÷×Ó¾ä
    create procedure p2()
    language SQL
     NOT DETERMINISTIC
    SQL SECURITY DEFINER
    COMMENT ''
     select current_date,rand() from t;
·´Ó³´æ´¢¹ý³ÌÌØÐÔµÄ×Ó¾ä.×Ó¾äÄÚÈÝÔÚÀ¨ºÅÖ®ºó,Ö÷Ìå֮ǰ.ÕâЩ
×Ӿ䶼ÊÇ¿ÉÑ¡µÄ,ËûÃÇÓÐʲô×÷ÓÃÄØ 
LANGUAGE SQL×Ó¾äÊÇûÓÐ×÷ÓõÄ.½ö½öÊÇΪÁË˵Ã÷ÏÂÃæ¹ý³ÌµÄÖ÷ÌåʹÓÃSQLÓï
ÑÔ±àд.ÕâÌõÊÇϵͳĬÈϵÄ,µ«ÄãÔÚÕâÀïÉùÃ÷ÊÇÓÐÓõÄ,ÒòΪijЩDBMS(IBMµÄDB2)ÐèÒª
Ëü,Èç¹ûÄã¹Ø×¢DB2µÄ¼æÈÝÎÊÌâ×îºÃ»¹ÊÇÓÃÉÏ.´ËÍâ,½ñºó¿ÉÄÜ»á³öÏÖ³ýSQLÍâµÄÆäËûÓïÑÔ
Ö§³ÖµÄ´æ´¢¹ý³Ì
NOT DETERMINISTIC,ÊÇ´«µÝ¸øϵͳµÄÐÅÏ¢.ÕâÀïÒ»¸öÈ·¶¨¹ý³ÌµÄ¶¨Òå¾ÍÊÇÄÇ
Щÿ´ÎÊäÈëÒ»ÑùÊä³öÒ²Ò»ÑùµÄ³ÌÐò
SQL SECURITY,¿ÉÒÔ¶¨ÒåΪSQL SECURITY DEFINER»òSQL SECURITY
INVOKER.
Õâ¾Í½øÈëÁËȨÏÞ¿ØÖƵÄÁìÓòÁË£¬SQL SECURITY DEFINERÒâζ×ÅÔÚµ÷ÓÃʱ¼ì²é´´½¨¹ý³ÌÓû§µÄȨÏÞ(ÁíÒ»¸öÑ¡ÏîÊÇSQL SECURITY
INVOKER). ÔÚ¶øÑÔ,ʹÓÃSQL SECURITY DEFINERÖ¸Áî¸æËßMySQL·þÎñÆ÷¼ì²é´´½¨¹ý³ÌµÄÓû§¾Í


Ïà¹ØÎĵµ£º

mysql ¸´ÖƼǼ

¸´ÖƼǼ,²ÉÓÃ×Ô²éѯ·½Ê½
sql
INSERT INTO `table` ('id','aa','bb','cc') SELECT 'id','aa','bb','cc' from `table` (WHERE .....) 
Tips:
/**
* ¸´ÖÆмͼµÄʱºò,¿ÉÄÜÒª¸üÐÂid»òÕßÊDz¿·ÖÊý¾Ý(¼ÙÉèid×ÔÔö¼ÓµÄÇé¿ö)
*
* text_aa Ϊ¹Ì¶¨Öµ ,¿ÉÔڽű¾µ÷ÓÃÖи³±äÁ¿Öµ Èç($aa)
* ×¢Òâ'text_aa' Óë `cc` µÄÇø±ð ......

mysql Ö÷´ÓÐĵÃ


grant replication slave on *.* to 'guest'@'192.168.1.%' identified by '123456'
change master to master_host='192.168.1.190',master_user='guest',master_password='123456',master_port=3306
mysql> change master to master_host='192.168.1.190',master_user='guest',master_password='123456',master_log ......

MYSQL my.cnfÅäÖÃÖÐÎÄÏê½â

MYSQL--my.cnfÅäÖÃÖÐÎÄÏê½â ZZ2007Äê08ÔÂ16ÈÕ ÐÇÆÚËÄ 15:53mysqld³ÌÐò--Ŀ¼ºÍÎļþ
ÒýÓÃ
basedir = path   ʹÓøø¶¨Ä¿Â¼×÷Ϊ¸ùĿ¼(°²×°Ä¿Â¼)¡£
character-sets-dir = path   ¸ø³ö´æ·Å×Å×Ö·û¼¯µÄĿ¼¡£
datadir = path   ´Ó¸ø¶¨Ä¿Â¼¶ÁÈ¡Êý¾Ý¿âÎļþ¡£
pid-file = filename   Î ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ