MySQLÓëÊÂÎñ
×÷ÕߣºÀÏÍõ
MySQL5.X¶¼ÒѾ·¢²¼ºÃ¾ÃÁË£¬µ«ÊÇ»¹ÓкܶàÈËÈÏΪMySQLÊDz»Ö§³ÖÊÂÎñ´¦ÀíµÄ£¬Õâ²»µÃ²»¹ÖËûÃÇÊǹª¹ÑÎŵģ¬Æäʵ£¬Ö»ÒªÄãµÄMySQL°æ±¾Ö§³ÖBDB»òInnoDB±íÀàÐÍ£¬ÄÇôÄãµÄMySQL¾Í¾ßÓÐÊÂÎñ´¦ÀíµÄÄÜÁ¦¡£ÕâÀïÃ棬ÓÖÒÔInnoDB±íÀàÐÍÓõÄ×î¶à£¬ËäÈ»ºóÀ´·¢ÉúÁËÖîÈçOracleÊÕ¹ºInnoDBµÈÁîMySQL²»Ë¬µÄÊÂÇ飬µ«ÄÇЩÉÌÒµÉϵĶ·ÕùÓë¼¼ÊõÎ޹أ¬ÏÂÃæÒÔInnoDB±íÀàÐÍΪÀý¼òµ¥ËµÒ»ÏÂMySQLÖеÄÊÂÎñ¡£
ÏÈÀ´Ã÷È·Ò»ÏÂÊÂÎñÉæ¼°µÄÏà¹Ø֪ʶ£º
ÊÂÎñ¶¼Ó¦¸Ã¾ß±¸ACIDÌØÕ÷¡£ËùνACIDÊÇAtomic£¨Ô×ÓÐÔ£©£¬Consistent£¨Ò»ÖÂÐÔ£©£¬Isolated£¨¸ôÀëÐÔ£©£¬Durable£¨³ÖÐøÐÔ£©Ëĸö´ÊµÄÊ××ÖĸËùд£¬ÏÂÃæÒÔ“ÒøÐÐתÕʔΪÀýÀ´·Ö±ð˵Ã÷Ò»ÏÂËüÃǵĺ¬Ò壺
Ô×ÓÐÔ£º×é³ÉÊÂÎñ´¦ÀíµÄÓï¾äÐγÉÁËÒ»¸öÂß¼µ¥Ôª£¬²»ÄÜÖ»Ö´ÐÐÆäÖеÄÒ»²¿·Ö¡£»»¾ä»°Ëµ£¬ÊÂÎñÊDz»¿É·Ö¸îµÄ×îСµ¥Ôª¡£±ÈÈ磺ÒøÐÐתÕʹý³ÌÖУ¬±ØÐëͬʱ´ÓÒ»¸öÕÊ»§¼õȥתÕʽð¶î£¬²¢¼Óµ½ÁíÒ»¸öÕÊ»§ÖУ¬Ö»¸Ä±äÒ»¸öÕÊ»§ÊDz»ºÏÀíµÄ¡£
Ò»ÖÂÐÔ£ºÔÚÊÂÎñ´¦ÀíÖ´ÐÐÇ°ºó£¬Êý¾Ý¿âÊÇÒ»Öµġ£Ò²¾ÍÊÇ˵£¬ÊÂÎñÓ¦¸ÃÕýÈ·µÄת»»ÏµÍ³×´Ì¬¡£±ÈÈ磺ÒøÐÐתÕʹý³ÌÖУ¬ÒªÃ´×ªÕʽð¶î´ÓÒ»¸öÕÊ»§×ªÈëÁíÒ»¸öÕÊ»§£¬ÒªÃ´Á½¸öÕÊ»§¶¼²»±ä£¬Ã»ÓÐÆäËûµÄÇé¿ö¡£
¸ôÀëÐÔ£ºÒ»¸öÊÂÎñ´¦Àí¶ÔÁíÒ»¸öÊÂÎñ´¦ÀíûÓÐÓ°Ïì¡£¾ÍÊÇ˵ÈκÎÊÂÎñ¶¼²»¿ÉÄÜ¿´µ½Ò»¸ö´¦ÔÚ²»ÍêÕû״̬ϵÄÊÂÎñ¡£±ÈÈç˵£¬ÒøÐÐתÕʹý³ÌÖУ¬ÔÚתÕÊÊÂÎñûÓÐÌύ֮ǰ£¬ÁíÒ»¸öתÕÊÊÂÎñÖ»ÄÜ´¦Óڵȴý״̬¡£
³ÖÐøÐÔ£ºÊÂÎñ´¦ÀíµÄЧ¹ûÄܹ»±»ÓÀ¾Ã±£´æÏÂÀ´¡£·´¹ýÀ´Ëµ£¬ÊÂÎñÓ¦µ±Äܹ»³ÐÊÜËùÓеÄʧ°Ü£¬°üÀ¨·þÎñÆ÷¡¢½ø³Ì¡¢Í¨ÐÅÒÔ¼°Ã½Ìåʧ°ÜµÈµÈ¡£±ÈÈ磺ÒøÐÐתÕʹý³ÌÖУ¬×ªÕʺóÕÊ»§µÄ״̬ҪÄܱ»±£´æÏÂÀ´¡£
ÔÙÀ´¿´¿´ÄÄЩÎÊÌâ»áÓõ½ÊÂÎñ´¦Àí£º
ÕâÀﲻ˵“ÒøÐÐתÕÊ”µÄÀý×ÓÁË£¬ËµÒ»¸ö´ó¼Òʵ¼Ê¸üÈÝÒ×Óöµ½µÄ“ÍøÉϹºÊ锵ÄÀý×Ó¡£ÏȼÙÉèÒ»ÏÂÎÊÌâµÄ±³¾°£ºÍøÉϹºÊ飬ijÊ飨Êý¾Ý¿â±àºÅΪ123£©Ö»Ê£×îºóÒ»±¾£¬¶øÕâ¸öʱºò£¬Á½¸öÓû§¶ÔÕâ±¾Ê鼸ºõͬʱ·¢³öÁ˹ºÂòÇëÇó£¬ÈÃÎÒÃÇ¿´¿´Õû¸ö¹ý³Ì£º
ÔÚ¾ßÌå·ÖÎö֮ǰ£¬ÏÈÀ´¿´¿´Êý¾Ý±íµÄ¶¨Ò壺
-------------------------------------------------------------------------------
create table book
(
book_id unsigned int(10) not null auto_increment,
book_name varchar(100) not null,
book_price float(5, 2) not null, #ÎÒ¼ÙÉèÿ±¾ÊéµÄ¼Û¸ñ²»»á³¬¹ý999.99Ôª
book_number int(1
Ïà¹ØÎĵµ£º
Ïë²âÊÔϱí·ÖÇø¹¦Äܸú×ÔÖ÷µÄ·Ö²¼Ê½µÄÐÔÄܲîÒ죬½øÐÐÁ˼òµ¥µÄ²âÊÔ£¬Ç°ºó»¨·ÑÁË°ë¸öСʱ£¬¿ÉÄܲâÊÔÊý¾Ý²»Ì«×¼È·¡£
¡¾²âÊÔ»·¾³¡¿
²Ù×÷ϵͳ£ºWindows XP SP2
MySQL£º 5.1.19-beta-community-nt-debug
¡¾²âÊÔ¹ý³Ì¡¿
²é¿´MySQL°æ±¾£º
mysql> select version();
+--------------------------------+
| version() ......
ÔÚ
oracle
ÖУ¬
sequence
Ìṩ¶à±í¶à×ֶοɹ²ÓÃÒ»¸ö²»Öظ´Öµ¡£
Mysql
ÖдæÔÚ×ÔÔöÁУ¬»ù±¾¿ÉÒÔÂú×ã
PK
µÄÒªÇó¡£µ«×ÔÔöÁдæÔÚÏÞÖÆ£º
a.
Ö»ÄÜÓÃÓÚ±íÖеÄÒ»¸ö×ֶΣ¬Ò»ÕŲ»ÄÜͬʱ´æÔÚÁ½¸öÒÔÉϵÄ×ÔÔöÁÐ
;
b.
×ÔÔöÁбØÐë±»¶¨ÒåΪ
key
£¨
PK
»ò
FK
£©
;
c.
×ÔÔöÁв»Äܱ»¶à¸ö±í¹²ÓÃ
;
d.
µ±
insert
Óï¾ä² ......
×÷ÕߣºÐûÕ×Åô
--------------------------------------------------------------------------------------------------------------------------------------------
½ñÌìÔÚ±¾±¾ÉÏ°²×°MYSQL£¬ÔÚ°²×°¹ý³Ì³öÏÖÁËһЩÆæ¹ÖµÄÎÊÌ⣬Òò´ËÔÚÕâÀï·ÖÏíÕû¸ö°²×°Á÷³ÌÓë´íÎó½â¾ö·½·¨¡£
MySQL°æ±¾£º5.1.40-community
1¡¢ÏÂÔØ°²×°°ü²¢° ......
mysqladmin extended (¾ø¶ÔÖµ)
ÖصãÈ¥¼àÊÓµÄÖµÓУº
* Slave_running:Èç¹ûϵͳÓÐÒ»¸ö´Ó¸´ÖÆ·þÎñÆ÷£¬Õâ¸öÖµÖ¸Ã÷ÁË´Ó·þÎñÆ÷µÄ½¡¿µ¶È
* Threads_connected:µ±Ç°¿Í»§¶ËÒÑÁ¬½ÓµÄÊýÁ¿¡£Õâ¸öÖµ»áÉÙÓÚÔ¤ÉèµÄÖµ£¬µ«ÄãÒ²ÄܼàÊÓµ½Õâ¸öÖµ½Ï´ó£¬Õâ¿É±£Ö¤¿Í»§¶ËÊÇ´¦ÔÚ»îԾ״̬¡£
* Threads_running:Èç¹ûÊý¾Ý¿â³¬¸ººÉÁË£¬Ä㽫»áµÃµ½Ò»¸ö ......