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

MySQLµÄ±íËøÎÊÌâ

ÔÚmysqlÊÖ²áÀïÃæÓÐÒ»¶ÎÃèÊö¹ØÓÚlock tablesµÄÓï·¨µÄ.
LOCK TABLES    tbl_name [AS alias] {READ [LOCAL] | [LOW_PRIORITY] WRITE}    [, tbl_name [AS alias] {READ [LOCAL] | [LOW_PRIORITY] WRITE}] ...UNLOCK TABLESREAD
µ±±í²»´æÔÚ WRITE дËøʱ READ ¶ÁËø±»Ö´ÐÐ,Õâ¸Ã״̬ÏÂ,µ±Ç°Ï̲߳»¿ÉÒÔÐÞ¸Ä(insert,update,delete),ÆäËûÏ̵߳ÄÐ޸IJÙ×÷½øÈëÁжÓ,µ±µ±Ç°Ïß³ÌÊÍ·ÅËø,ÆäËûÏß³ÌÐ޸ı»Ö´ÐÐ.
READ LOCAL
READ LOCALºÍREADÖ®¼äµÄÇø±ðÊÇ£¬READ LOCALÔÊÐíÔÚËø¶¨±»±£³Öʱ£¬Ö´ÐзdzåÍ»ÐÔINSERTÓï¾ä£¨Í¬Ê±²åÈë-Concurrent InsertµÄÌØÐÔ£¬Ö÷ÒªÊÇÕë¶ÔMyISAM´æ´¢ÒýÇæÀ´ËµµÄ£©¡£µ«ÊÇ£¬Èç¹ûÄúÕý´òËãÔÚMySQLÍâÃæ²Ù×÷Êý¾Ý¿âÎļþ£¬Í¬Ê±Äú±£³ÖËø¶¨£¬Ôò²»ÄÜʹÓÃREAD LOCAL¡£¶ÔÓÚInnoDB±í£¬READ LOCALÓëREADÏàͬ(tenfyµÄʵÑé½áÂÛÊÇ£ºMyISAM´æ´¢ÒýÇ棬ȷʵÔÚÏß³ÌaÖ´ÐÐread local rockºó£¬ÆäËûÏß³ÌÊÇ¿ÉÒÔÔÙ½øÐÐinsert²Ù×÷µÄ£¬updateÔò±»×èÈû£¬µ«¶ÔInnoDB´æ´¢ÒýÇæÀ´Ëµ£¬insertºÍupdate¾ù±»×èÈû£¬Òò´Ëread local¸ü¶àµÄÊǶÔMyISAM´æ´¢ÒýÇæÀ´ËµµÄ)¡£
WRITE
³ýÁ˵±Ç°Óû§±»ÔÊÐí¶ÁÈ¡ºÍÐ޸ı»Ëø±íÍ⣬ÆäËûÓû§µÄËùÓзÃÎʱ»ÍêÈ«×èÖ¹¡£×¢ÒâµÄÊÇÔÚµ±Ç°Ï̵߳±WRITE±»Ö´ÐеÄʱºò,¼´Ê¹Ö®Ç°¼ÓÁËREADû±»È¡Ïû,Ò²»á±»È¡Ïû.
LOW_PRIORITY WRITE
½µµÍÓÅÏȼ¶µÄWRITE,ĬÈÏWRITEµÄÓÅÏȼ¶¸ßÓÚREAD.¼ÙÈ統ǰÏ̵߳ÄLOW_PRIORITY WRITEÔÚÁжÓÀïÃæ,ÔÚδִÐÐ֮ǰÆäËûÏ̴߳«ËÍÒ»ÌõREAD,ÄÇôLOW_PRIORITY WRITE¼ÌÐøµÈ´ý.
µ±ÄúʹÓÃLOCK TABLESʱ£¬Äú±ØÐëËø¶¨Äú´òËãÔÚ²éѯÖÐʹÓõÄËùÓÐµÄ±í¡£ËäȻʹÓÃLOCK TABLESÓï¾ä»ñµÃµÄËø¶¨ÈÔÈ»ÓÐЧ£¬µ«ÊÇÄú²»ÄÜ·ÃÎÊûÓб»´ËÓï¾äËø¶¨µÄÈÎºÎµÄ±í¡£Í¬Ê±£¬Äú²»ÄÜÔÚÒ»´Î²éѯÖжà´ÎʹÓÃÒ»¸öÒÑËø¶¨µÄ±í——ʹÓñðÃû´úÌ棬ÔÚ´ËÇé¿öÏ£¬Äú±ØÐë·Ö±ð»ñµÃ¶Ôÿ¸ö±ðÃûµÄËø¶¨¡£
ÊÖ²á¸ø³öÁËÈçϵÄÀý×Ó:
mysql> LOCK TABLE t WRITE, t AS t1 WRITE;#´ËʱËø¶¨µÄÓ¦¸ÃËãÊÇt±íºÍËüµÄ±ðÃût1
mysql> INSERT INTO t SELECT * from t;#´ËʱʹÓÃÁË2´Ît±í
ERROR 1100: Table 't' was not locked with LOCK TABLES
mysql> INSERT INTO t SELECT * from t AS t1;
Èç¹ûÄúµÄ²éѯʹÓÃÒ»¸ö±ðÃûÒýÓÃÒ»¸ö±í£¬ÄÇôÄú±ØÐëʹÓÃͬÑùµÄ±ðÃûËø¶¨¸Ã±í¡£Èç¹ûûÓÐÖ¸¶¨±ðÃû£¬Ôò²»»áËø¶¨¸Ã±í¡£
mysql> LOCK TABLE t READ;
mysql> SELECT * from t AS myalias;#ÒòΪ²»ÄÜ·ÃÎÊûÓб»Óï¾äËø¶¨µÄÈκεıí,Ó¦¸ÃËã°É±ðÃûmyaliasËã×÷±íÁË
ERROR 1


Ïà¹ØÎĵµ£º

mysqlÐÔÄÜÓÅ»¯µÄ²ÎÊý¼ò½é


1)¡¢back_log£º
ÒªÇó MySQL ÄÜÓеÄÁ¬½ÓÊýÁ¿¡£µ±Ö÷ÒªMySQLÏß³ÌÔÚÒ»¸öºÜ¶Ìʱ¼äÄڵõ½·Ç³£¶àµÄÁ¬½ÓÇëÇó£¬Õâ¾ÍÆð×÷Óã¬È»ºóÖ÷Ï̻߳¨Ð©Ê±¼ä(¾¡¹ÜºÜ¶Ì)¼ì²éÁ¬½Ó²¢ÇÒÆô¶¯Ò»¸öÐÂÏ̡߳£ 
back_logÖµÖ¸³öÔÚMySQLÔÝʱֹͣ»Ø´ðÐÂÇëÇó֮ǰµÄ¶Ìʱ¼äÄÚ¶àÉÙ¸öÇëÇó¿ÉÒÔ±»´æÔÚ¶ÑÕ»ÖС£Ö»ÓÐÈç¹ûÆÚÍûÔÚÒ»¸ö¶Ìʱ¼äÄÚÓкܶàÁ¬½Ó£¬ÄãÐèÒªÔ ......

XPÏÂApache php mysql phpmyAdminµÄ°²×°ÓëÅäÖÃ

³õѧphp,ÐèÒª´î½¨Æ俪·¢»·¾³¡£ÓÉÓÚ°æ±¾¸üÌæµÈÔ­Òò£¬ÍøÉϵķ½·¨¼¸ºõÒ»ÈËÒ»¸öÑù£¬ÈÃÈËÎÞËùÊÊ´Ó¡£×òÌ컨ÁËÒ»ÍíÉÏʱ¼ä²ÅÔÚXPÏÂÅäÖúã¬ÏÖ½«ÆäÕûÀí³öÀ´£¬Ï£ÍûÄܶԱðÈËÓÐÓᣣ¨2007-11-21£©
 
Ò»¡¢ ÏÂÔØÈí¼þ¡£
1. ÏÂÔØapache_2.0.55-win32-x86-no_ssl.msi£¬ÓÒ¼üÓÃѸÀ×µã»÷´Ë´¦ÏÂÔØ£¨Ö±½Óµã»÷²»ÐУ©¡£
2. ÏÂÔØphp-5 ......

MySQLÖÐÎÄÂÒÂë½â¾ö·½°¸

˵Ã÷: ÔÚMYSQLÖУ¬Èç¹ûʹÓÃȱʡµÄ×Ö·û¼¯£¬ÔÚ½¨¿â¡¢½¨±íʱ£¬Ä¬ÈÏʹÓõÄÊÇlatin1×Ö·û¼¯£¬
ΪISO 8859-1Î÷Å·×Ö·û¼¯¡£²åÈëÖÐÎÄ×Ö·ûʱ£¬ÓëÖ®²»Æ¥Å䣬¾Í»á³öÏÖÂÒÂë¡£
¡¾½â¾ö·½°¸¡¿
1. ´ò¿ªÎļþ: C:\Program Files\MySQL\MySQL Server 5.0\my.ini;
2. ½«ÆäÖеÄdefault-character-set=latin1¸ÄΪdefault-character-set=gb2312, ......

Tomcat+mysqlÁ¬½Ó³ØµÄÅäÖÃÓë²âÊÔ


»·¾³:
Tomcat6.0.18
Mysql: 5.1.36
Windwos XP sp2
×î½üÐèÒªÓõ½Tomcat+mysqlÁ¬½Ó³ØµÄÅäÖÃ,½ñÌìÔÚÍøÉϲéÁ˺öà×ÊÁÏ,ÀÏ×ÊÁÏÌ«¶à,¶ÔÓÚÒÔÉϵÄÀÏ°æ±¾tomcat¿ÉÄÜÓÐÓÃ,±¾ÈËûÓвâÊÔ¹ý,Õýȷд³ötomcat6.0ÅäÖõÄÎļäºÜÉÙ!ºÃ¶à×ÊÁÏÉÏÃæµÄÅäÖöÔÓÚÏÖÔÚаæµÄ¼¸ºõ¶¼ÊÇÓÐÎÊÌâµÄ,Ê®´íÆß°Ë!½ñÌì°ÑÎÒÅäÖõÄÕýÈ··½·¨Ð´ÏÂÀ´,¹©´ó¼Ò²Î¿¼ ......

PHPÓëMYSQLµÄ´æ´¢¹ý³Ì

ʵÀýÒ»£ºÎ޲εĴ洢¹ý³Ì
$conn = mysql_connect('localhost','root','root') or die ("Êý¾ÝÁ¬½Ó´íÎó!!!");
mysql_select_db('test',$conn);
$sql = "
create procedure myproce()
begin
INSERT INTO user (id, username, sex) VALUES (NULL, 's', '0');
end;
";
mysql_query($sql);//´´½¨Ò»¸ömyproceµÄ´æ´¢¹ý³Ì
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ