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

MySQLÐÐËøÉîÈëÑо¿

      ×öÏîĿʱÓÉÓÚÒµÎñÂß¼­µÄÐèÒª£¬±ØÐë¶ÔÊý¾Ý±íµÄÒ»Ðлò¶àÐмÓÈëÐÐËø£¬¾Ù¸ö×î¼òµ¥µÄÀý×Ó£¬Í¼Êé½èÔÄϵͳ¡£¼ÙÉè id=1 µÄÕâ±¾Êé¿â´æΪ 1 £¬µ«ÊÇÓÐ 2 ¸öÈËͬʱÀ´½èÕâ±¾Ê飬´Ë´¦µÄÂß¼­Îª :
Select restnum from book where id =1 ;
-- Èç¹û restnum ´óÓÚ 0 £¬Ö´ÐÐ update
Update book set restnum=restnum-1 where id=1 ;
      ÎÊÌâ¾ÍÀ´ÁË£¬µ± 2 ¸öÈËͬʱÀ´½èµÄʱºò£¬ÓпÉÄܵÚÒ»¸öÈËÖ´ÐÐ select Óï¾äµÄʱºò£¬µÚ¶þ¸öÈ˲åÁ˽øÀ´£¬ÔÚµÚÒ»¸öÈËûÀ´µÃ¼°¸üРbook ±íµÄʱºò£¬µÚ¶þ¸öÈ˲鵽Êý¾ÝÁË£¬ÆäʵÊÇÔàÊý¾Ý£¬ÒòΪµÚÒ»¸öÈË»á°Ñ restnum Öµ¼õ 1 £¬Òò´ËµÚ¶þ¸öÈ˱¾À´Ó¦¸ÃÊDz鵽 id=1 µÄÊé restnum Ϊ 0 ÁË£¬Òò´Ë²»»áÖ´ÐÐ update £¬¶ø»á¸æËßËü id=1 µÄÊéûÓпâ´æ ÁË£¬¿ÉÊÇÊý¾Ý¿âÄĶ®ÕâЩ£¬Êý¾Ý¿âÖ»¸ºÔðÖ´ÐÐÒ»ÌõÌõ SQL Óï¾ä£¬Ëü²Å²»¹ÜÖмäÓÐûÓÐÆäËû sql Óï¾ä²å½øÀ´£¬ËüÒ²²»ÖªµÀÒª°ÑÒ»¸ö session µÄ sql Óï¾äÖ´ÐÐÍêÔÙÖ´ÐÐÁíÒ»¸ö session µÄ¡£Òò´Ë»áµ¼Ö²¢·¢µÄʱºò restnum ×îºóµÄ½á¹ûΪ -1 £¬ÏÔÈ»ÕâÊDz»ºÏÀíµÄ£¬ËùÒÔ£¬²Å³öÏÖËøµÄ¸ÅÄ Mysql ʹÓà innodb ÒýÇæ¿ÉÒÔͨ¹ýË÷Òý ¶ÔÊý¾ÝÐмÓËø¡£ÒÔÉϽèÊéµÄÓï¾ä±äΪ£º
Begin;
Select restnum from book where id =1 for update ;
-- ¸ø id=1 µÄÐмÓÉÏÅÅËüËøÇÒ id ÓÐË÷Òý
Update book set restnum=restnum-1 where id=1 ;
Commit;
ÕâÑù£¬µÚ¶þ¸öÈËÖ´Ðе½ select Óï¾äµÄʱºò¾Í»á´¦Óڵȴý״ֱ̬µ½µÚÒ»¸öÈËÖ´ÐÐ commit ¡£´Ó¶ø±£Ö¤Á˵ڶþ¸öÈ˲»»á¶Áµ½µÚÒ»¸öÈËÐÞ¸ÄÇ°µÄÊý¾Ý¡£
ÄÇÕâÑùÊDz»ÊÇÍòÎÞһʧÁËÄØ£¬´ð°¸ÊÇ·ñ¶¨µÄ¡£¿´ÏÂÃæµÄÀý×Ó¡£
 
¸úÎÒÒ»²½Ò»²½À´£¬ÏȽ¨Á¢±í
CREATE TABLE `book` (
`id` int(11) NOT NULL auto_increment,
`num` int(11) default NULL,
`name` varchar(20) default NULL, //Ô­ÌùÊÇvarchar(0)Ó¦¸ÃÊDZÊÎó£¬ÕâÀïtenfy¸Ä³Évarchar(20)
PRIMARY KEY (`id`),
KEY `asd` (`num`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk
ÆäÖÐ num ×ֶμÓÁËË÷Òý
È»ºó²åÈëÊý¾Ý£¬ÔËÐУ¬ 
insert into book(num) values(11),(11),(11),(11),(11);
insert into book(num) values(22),(22),(22),(22),(22);
 
 
È»ºó´ò¿ª 2 ¸ö mysql ¿ØÖÆ̨´°¿Ú£¬Æäʵ¾ÍÊǽ¨Á¢ 2 ¸ö session ×ö²¢·¢²Ù×÷
*************************************


Ïà¹ØÎĵµ£º

²é¿´mysql°æ±¾µÄËÄÖÖ·½·¨

ת×Ô£ºhttp://www.yayu.org/look.php?id=113
1£ºÔÚÖÕ¶ËÏ£ºmysql -V¡£
ÒÔÏÂÊÇ´úÂëƬ¶Î£º
[shengting@login ~]$ mysql -V
mysql  Ver 14.7 Distrib 4.1.10a, for redhat-linux-gnu (i686)
    2£ºÔÚmysqlÖУºmysql> status;
ÒÔÏÂÊÇ´úÂëƬ¶Î£º
mysql> status;
--------------
mysql  ......

MysqlÖÐÎÄÂÒÂëÎÊÌâÖ®·ÖÎö

MysqlÖÐÎÄÂÒÂëÎÊÌâ
֮ǰ±»mysqlÖÐ×ÜÊdzöÏÖÖÐÎÄÂÒÂë¸ãµÃÔÆÀïÎíÀÔÚÍøÉÏÒ²ËÑÁËЩÏà¹Ø×ÊÁÏ£¬¿É½á¹û¸üÈÃÎÒ¾õµÃ×Ö·û¼¯µÄת»»ÊÇÏ൱¸´ÔÓ£¬ÉõÖÁÓÐÁ˵ִ¥ÐÄÀí£¬²»¹ý»¹ºÃÔÚ×îºóËѵ½¼¸Æª¾­µäµÄÎÄÕ£¬¾­¹ýÑжÁ×ÜËãÃ÷°×¹ýÀ´£¡ºÃÎÄÕ£¬²»¸Ò¶ÀÏí£¬ÏÖ½«ÎÄÕÂÉÔ×÷ÕûÀíÓë´ó¼Ò·ÖÏí¡£
×Ö·û¼¯»ù±¾¸ÅÄ
http://home.phpchina.com/space.php ......

[Õª³­/¼Ç¼]MySQLµ¼Èë/µ¼³ö.sqlÎļþ

µ¼³ö.sqlÎļþ
 
1.½«Êý¾Ý¿âtransfer_server_dbµ¼³öµ½transfSRV.sqlÎļþÖУº
mysqldump -u root -p transfer_server_db > /home/eric/transfSRV.sql
2.½«Êý¾Ý¿âtransfer_server_dbÖеÄdevice_info_tableµ¼³öµ½table.sqlÎļþÖУº
mysqldump -u root -p transfer_server_db device_info_table > /home/eric/ta ......

ÀûÓÃBind DLZ MySQL ¹¹½¨ÖÇÄÜDNS

±¾ÎÄÀ´×Ô: ITÔËάר¼ÒÍø ×÷Õß: NetSeek ÈÕÆÚ: 2009-3-8 19:52 ÔĶÁ: 742 ÈË ´òÓ¡ ÊÕ²Ø DNS, Bind, DLZ, ÖÇÄÜ, MySQL ×÷Õß:NetSeek  http://www.linuxtone.org
ÈÕÆÚ:2009-3-7 gmail:cnseek@gmail.com
ÍƼöÏÂÔØPDF°æ£¨·½±ã²éÔÄ):http://www.linuxtone.org/project/cdn/bind-dlz-view.pdf
¡¾Ìâ ¸Ù¡ ......

ÀûÓÃFederatedÒýÇæ½øÐÐmysql¸´ÖÆ

Accessing Distributed Data with the Federated Storage Engine
http://dev.mysql.com/tech-resources/articles/mysql-federated-storage.html
Federated´æ´¢ÒýÇæ¿ÉÒÔʹ¼¸Ì¨Êý¾Ý¿âÂß¼­ÉÏ×é³ÉÒ»¸öÊý¾Ý¿â£¬Æä×÷ÓÃÏ൱ÓÚOracleµÄÊý¾Ý¿âÁ´½Ó£¬Í¨Ë×µØ˵£¬¼´ÔÚ±¾µØ½¨Á¢Ô¶³ÌµÄÊý¾Ý¿â±íµÄÒýÓá£
MysqlÐèÒª5.0ÒÔÉÏ
£¨1£©²é¿´ÊÇ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ