MySQLÒýÇæ: Ñ¡ÔñInnoDB »¹ÊÇ MyISAM£¿
MyISAM ºÍ InnoDB ½²½â InnoDBºÍMyISAMÊÇÐí¶àÈËÔÚʹÓÃMySQLʱ×î³£ÓõÄÁ½¸ö±íÀàÐÍ£¬ÕâÁ½¸ö±íÀàÐ͸÷ÓÐÓÅÁÓ£¬ÊÓ¾ßÌåÓ¦Óöø¶¨¡£
¿ª·¢¹ý³ÌÖÐÈýÖÖ¶«Î÷ÓÀÔ¶²»Òª·Åµ½Êý¾Ý¿âÀï
ÎÒÒѾÔںܶàÑݽ²Àï˵¹ý£¬¸Ä½øÄãµÄϵͳµÄ×îºÃµÄ·½·¨ÊÇÏȱÜÃâ×ö¡°´ÀÊ¡±¡£ÎÒ²¢²»ÊÇ˵Äã»òÄ㿪·¢µÄ¶«Î÷¡°´À¡±£¬Ö»ÊÇÓÐЩ¾ö¶¨ºÜÈÝÒ×±»ÈËÃǺöÂÔµôÆä°µº¬µÄÇ£Á¬£¬ÈÏʶ²»µ½ÕâÑù×ö¶Ôϵͳά»¤ÓÈÆäÊÇϵͳÉý¼¶´øÀ´¶à´óµÄÂé·³¡£×÷Ϊһ¸ö¹ËÎÊ£¬ÏñÕâÑùµÄÊÂÇéÎÒµ½´¦¶¼Äܼûµ½£¬ÎÒ»¹...
˵À´²ÑÀ¢£¬¹¤×÷²î²»¶à4ÄêÁË£¬Ö±µ½Ç°Ð©ÈÕ×Ó±»DBAÕÒÉÏÃÅÈÃÎÒÓÅ»¯Ò»¸öCPUÕ¼Óúܸߵĸ´ÔÓSQLÓï¾äʱ£¬ÎÒ²ÅͻȻÒâʶµ½Á˲ÎÊý»¯²éѯµÄÖØÒªÐÔ¡£ÏàÐÅÓкܶ࿪·¢ÕߺÍÎÒÒ»Ñù¶ÔÓÚ²ÎÊý»¯²éѯÈÏʶ±È½ÏÄ£ºý£¬Ã»ÓÐÒýÆð×ã¹»µÄÖØÊÓ
ÁíÒ»¸ö½Ç¶È¿´Ç§Íò¼¶Êý¾ÝµÄ·ÖÒ³½â¾ö·½°¸
Ïë˵Õâ¸öÎÊÌ⣬À´Ô´À´×ÔÓÚCSDNÂÛ̳µÄÒ»¸öÌû×Ó£º¡¶sqlserver2005£¬1690ÍòµÄÊý¾ÝÁ¿Ôõô¿ìËÙ·ÖÒ³²éѯ¡·¡£ÔÚ֮ǰҲÓкܶàÈËÎÊÀàËÆÕâÑùµÄÎÊÌ⣬»Ø¸´ÕâÑùµÄÎÊÌ⣬ÎÒÃÇÒ»°ã»á´ÓË÷Òý£¬Ë®Æ½·ÖÇø£¬´¹Ö±·ÖÇøºÍÓ²¼þµÄÉý¼¶µÈ·½Ã濼ÂÇ¡£
NoSQL²úÆ·Ô½À´Ô½»ð£¬NoSQL²úƷͨ³£ÒÔÆä¸ßÐÔÄÜ£¬Ç¿À©Õ¹ÐԺ͸ßÈÝ´íÐÔΪ´ó¼ÒËù³ÆµÀ£¬ÎÒÃÇÔÚÎÊΪʲôNoSQL»áÁ÷ÐÐÆðÀ´µÄʱºò£¬»òÐíÓ¦¸ÃÎÊÒ»ÏÂΪʲôÕâЩ¹¦ÄÜ»á±äµÃÕâôÖØÒª£¬ÏÂÃæ±¾ÎÄÁоÙÒ»ÏÂ6¸öÔÒò¡£
¶ÔÓÚ³ÌÐò¿ª·¢ÈËÔ±£¬ÎÒÃÇÒª×öµ½²»µ«»áдSQL,»¹Òª×öµ½Ð´³öÐÔÄÜÓÅÁ¼µÄSQL¡£²»Í¬µÄSQL¶ÔÓÚ³ÌÐòµÄÖ´ÐлáÓкܴóµÄÇø±ð£¬ÌرðÊǶÔÓÚ´ó²¢·¢Á¿µÄ³ÌÐò¡£ÏÂÃæ±¾ÎĽ«¸ø´ó¼ÒÌṩһЩSQLÊéдÒÔ¼°ÓÅ»¯¼¼ÇÉ£¬ÏòÍù»á¶Ô´ó¼ÒÊÜÒæ·Ëdz¡£
PHP¿ª·¢Õß³£·¸µÄMySQL´íÎó×ܽá
Êý¾Ý¿âÊÇWEB´ó¶àÊýÓ¦Óÿª·¢µÄ»ù´¡¡£Èç¹ûÄãÊÇÓÃPHP£¬ÄÇô´ó¶àÊý¾Ý¿âÓõÄÊÇMYSQL¨CÒ²ÊÇLAMP¼Ü¹¹µÄÖØÒª²¿·Ö¡£
MongoDBÊÇÒ»¸ö»ùÓÚ·Ö²¼Ê½Îļþ´æ´¢µÄÊý¾Ý¿â¡£ÓÉC++ÓïÑÔ±àд¡£Ö¼ÔÚΪWEBÓ¦ÓÃÌṩ¿ÉÀ©Õ¹µÄ¸ßÐÔÄÜÊý¾Ý´æ´¢½â¾ö·½°¸¡£ÕâôºÃµÄ¶«¶«Ò»¶¨ÒªÑ§Ï°Ò»ÏÂÁË£¬ËäȻľÓÐÔÚʵ¼ÊÏîÄ¿ÖÐÔËÓ㬻¹ÊǼǼһÏÂ×Ô¼ºµÄ×ܽᡣ
MySQLÖÐvarcharÀàÐÍ×î´ó³¤¶ÈÑо¿
¹¤×÷µ±Öо³£±»Îʵ½Ò»¸öÎÊÌ⣺MySQLÖÐvarchar×î´ó³¤¶ÈÊǶàÉÙ£¿Õâ²»ÊÇÒ»¸ö¹Ì¶¨µÄÊý×Ö¡£±¾ÎļòҪ˵Ã÷Ò»ÏÂMysqlÏÞÖƹæÔò¡£
Mysqlµ÷ÓŹ¤¾ß - mysqlshow
mysqlshow£ÏÔʾÊý¾Ý¿â¡¢±íºÍÁÐÐÅÏ¢
mysqlshow¿Í»§¿ÉÓÃÀ´ºÜ¿ìµØ²éÕÒ´æÔÚÄÄЩÊý¾Ý¿â£¬Êý¾Ý¿âÖÐµÄ±í£¬±íÖеÄÁлòË÷Òý¡£
mysqlshowΪһЩSQLÏÔʾÓï¾äÌṩÁËÒ»¸öÃüÁîÐнçÃæ¡£ÏàͬµÄÐÅÏ¢¿ÉÒÔͨ¹ýÖ±½ÓʹÓÃÄÇЩÓï¾ä»ñµÃ¡£ÀýÈ磬Äã¿ÉÒÔ´Ómysql¿Í»§³ÌÐò·¢³öËüÃÇ¡£²Î¼û
[ur...
EXPLAIN tbl_name
»òÕß:
EXPLAIN SELECT select_options
EXPLAIN Óï¾ä¿ÉÒÔ±»µ±×÷ DESCRIBE µÄͬÒå´ÊÀ´Óã¬Ò²¿ÉÒÔÓÃÀ´»ñÈ¡Ò»¸öMySQLÒªÖ´ÐÐµÄ SELECT Óï¾äµÄÏà¹ØÐÅÏ¢¡£
EXPLAIN tbl_name Óï·¨ºÍ DESCRIBE tbl_name »ò SHOW COLUMNS FROM tbl_name Ò»Ñù...
¹¥»÷ÊÇÏÖ½ñ×îÁ÷ÐеĹ¥»÷·½Ê½£¬ÒÀ¿¿ËüÇ¿´óµÄÁé»îÐÔÎüÒýÁ˹ã´óºÚÃÔ¡£
OK,ÕâÒ»ÆÚÎÒ½«¸ø´ó¼Ò»ï×Ð×ÐϸϸµÄ´µÒ»´µphp£«mysql×¢È룬һ¶¨ÈÃÄãÂúÔضø¹éŶ£¨ËÈÓשͷÁ¨£¡£©¡£
±¾ÎÄÖ÷ÒªÊÇΪС²ËÃÇ·þÎñµÄ£¬Èç¹ûÄãÒѾÊÇÒ»Ö»ÀÏÄñÄØ£¬¿ÉÄÜijЩ¶«Î÷»á¸Ð¾õ±È½Ï·¦Î¶£¬µ«Ö»ÒªÄã×ÐϸµÄ...
PHP+MYSQL×¢ÈëʵÀýÓë·À·¶´ëÊ©×ܽá
×öÍøÕ¾°²È«Ê®·ÖÖØÒª£¬×î½ü×ܽáÁËÒÔÏÂSQL×¢Èë×î³£¼ûµÄÀý×ÓºÍÏà¹ØµÄ·À·¶´ëÊ©£¬ÔÚ´ËÓë´ó¼Ò¹²Ïí£¬Ï£Íû¶Ô´ó¼ÒÓÐËù°ïÖú¡£
ÁíÍâ×÷Ϊ³ÌÐòÔ±Ó¦¸ÃÀμǵÄÒ»¾ä»°£ºÒ»ÇÐÓû§ÊäÈëµÄ¶¼ÊDz»°²È«µÄ¡£
ReplicationÓÅ»¯µÄһЩ¸öÈË×ܽá
ÕâÁ½ÌìÓпտ´ÁËÒ»ÏÂppc2009´ó»áµÄһЩpdf£¬·¢ÏÖÕâ´Î¹ØÓÚReplicationµÄÌÖÂÛ»¹ÊǺܶàµÄ£¬ºÜ¶àÄÚÈݶ¼ºÜʵÓ㬾Í×ܽáÁËһϡ£±¾ÈËÓ¢ÎÄˮƽˮƽÓÐÏÞ£¬ÄÑÃâÓзÒëµÄ²»¶ÔµÄµØ·½£¬ÓÐÒÉÎÊ»¶ÓÌÖÂÛ£º£©
¹ØÓÚMysql×Ö·û¼¯ÎÊÌâµÄÎÊ´ð×ܽá
Êý¾Ý¿âÓÃ×Å·½±ã£¬¿ÉÊÇÇ£³¶µ½×Ö·û¼¯ÎÊÌâ×Åʵ·³ÈË£¬ÏÖÔÚ×ܽáһϴó¼Ò³£Åöµ½µÄÎÊÌ⣬ÒÔ½âÅóÓÑÃǵÄÀ§ÈÅ¡£
ʵÏÖmysqlµ¥±í±¸·ÝµÄ½Å±¾×ܽá
°²È«Æð¼û£¬·þÎñÆ÷ά»¤Öл᳣³£±¸·ÝÊý¾Ý±í£¬ÊÖ¹¤±¸·ÝÄÑÃⱿÊÖ±¿½Å£¬Ð§ÂʵÍÏ£¬ÓÚÊÇ×ܽáһϽű¾£¬¹©´ó¼ÒÏíÓá£
ÏëÔÚmysqlÖ´ÐÐsqlÓï¾ä֮ǰ¿´ËüµÄÔËÐÐЧÂÊÂ𣿺úÃÑо¿explain°É£¡
explainÏÔʾÁËmysqlÈçºÎʹÓÃË÷ÒýÀ´´¦ÀíselectÓï¾äÒÔ¼°Á¬½Ó±í¡£¿ÉÒÔ°ïÖúÑ¡Ôñ¸üºÃµÄË÷ÒýºÍд³ö¸üÓÅ»¯µÄ²éѯÓï¾ä¡£
¶ÔÓÚÕë¶Ô×Ö·û´®Î»ÖõIJÙ×÷£¬µÚÒ»¸öλÖñ»±ê¼ÇΪ1¡£
ASCII(str) ·µ»Ø×Ö·û´®strµÄ×î×óÃæ×Ö·ûµÄASCII´úÂëÖµ¡£Èç¹ûstrÊÇ¿Õ×Ö·û´®£¬·µ»Ø0¡£Èç¹ûstrÊÇNULL£¬·µ»ØNULL¡£
mysql> select ASCII('2');
-> 50
mysql> select ASCII(2);
-> 5...
²é¿´ºÍÉèÖÃMySQLÊý¾Ý¿â×Ö·û¼¯
LiunxÏÂÐÞ¸ÄMySQL×Ö·û¼¯£º
1.²éÕÒMySQLµÄcnfÎļþµÄλÖÃ
find / -iname '*.cnf' -print
/usr/share/mysql/my-innodb-heavy-4G.cnf
/usr/share/mysql/my-large.cnf
/usr/share/mysql/my-small.cnf
/usr/share/mysql/my-medium.cnf
/usr/share/mysql/my-...