Ò»:mysqlÀïÄ¿Ç°Ö»Ö§³Ö4ÖÖË÷Òý·Ö±ðÊÇ:b-tree,full-text,hashÒÔ¼°r-treeË÷Òý b-treeË÷ÒýÓ¦¸ÃÊÇmysqlÀï×î¹ã·ºµÄË÷ÒýµÄÁË,³ýÁËarchive,»ù±¾ËùÓеĴ洢ÒýÇ涼֧³ÖËü. 1.b-treeÔÚmyisamÀïµÄÐÎʽºÍinnodbÉÔÓв»Í¬ ÔÚinnodbÀïÃæÓÐÁ½ÖÖÐÎ̬:ÆäÒ»ÊÇprimary keyÐÎ̬Æäleaf nodeÀï´æ·ÅµÄÊÇÊý¾Ý.¶øÇÒ²»½ö´æ·ÅÁËË÷Òý¼üµÄÊý¾Ý,»¹´æ·ÅÁËÆäËû×ֶεÄÊý¾Ý.Æä¶þÊÇsecondary index,Æäleaf nodeºÍÆÕͨµÄb-tree²î²»¶à,Ö»ÊÇ»¹´æ·ÅÁËÖ¸ÏòÖ÷¼üµÄÐÅÏ¢. ¶øÔÚmyisamÀï,Ö÷¼üºÍÆäËûµÄ²¢Ã»ÓÐÌ«´óÇø±ð.²»¹ýºÍinnodb²»Ì«Ò»ÑùµÄµØ·½ÊÇ,ÔÚmyisamÀï,leaf nodeÀï´æ·ÅµÄ²»ÊÇÖ÷¼üµÄÐÅÏ¢,´æµÄÊÇÖ¸ÏòÊý¾ÝÎļþÀïµÄ¶ÔÓ¦Êý¾ÝÐеÄÐÅÏ¢. 2.hashË÷Òý,Ä¿Ç°ÎÒËùÖªµÀµÄ¾ÍÖ»ÓÐmemoryºÍndb clusterÖ§³ÖÕâÖÖË÷Òý. hashË÷ÒýÓÉÓÚÆä½á¹¹,ËùÒÔÔÚÿ´Î²éѯµÄʱºòÖ±½ÓÒ»´Îµ½Î»²»ÐÐb-treeÄÇÑù,Ò»µãµãµÄÇ°½ø,ËùÒÔhashË÷ÒýµÄЧÂʸßÓÚb-tree.µ«hashÒ²ÓÐȱµã,Ö÷ÒªÈçÏÂ: (1)ÓÉÓÚ´æ·ÅµÄÊÇhashÖµ,ËùÒÔ½öÖ§³Ö<=>ÒÔ¼°in²Ù×÷. (2)hashË÷ÒýÎÞ·¨Í¨¹ý²Ù×÷Ë÷ÒýÀ´ÅÅÐò,ÕâÊÇÒòΪ´æ·ÅµÄʱºò¾¹ýhash¼ÆËã,µ«ÊǼÆËãµÄhashÖµºÍ´æ·ÅµÄ²»Ò»¶¨ÏàµÈ,ËùÒÔÎÞ·¨ÅÅÐò. (3)ÔÚ×éºÏËùÒÔÀï,ÎÞ·¨¶Ô²¿·ÖʹÓÃË÷Òý. (4)²»ÄܱÜÃâÈ«±íɨÃè,Ö»ÊÇÓÉÓÚÔÚmemory±íÀïÖ§³Ö·ÇΨһֵhashË÷Òý,¾ÍÊDz»Í¬µÄË÷Òý¼ü,¿ÉÄÜ´æÔÚÏàͬµÄhashÖµ. (5)µ±´æÔÚ´óÁ¿ÏàͬhashÖµµÃʱºò,hashË÷ÒýµÄЧÂÊ»á±äµÍ. 3.full-textË÷Òý full-textÔÚmysqlÀï½öÓÐmyisamÖ§³ÖËü,¶øÇÒÖ§³Öfull-textµÄ×Ö¶ÎÖ»ÓÐchar,varchar,ÒÔ¼°textÊý¾ÝÀàÐÍ,full-textÖ÷ÒªÊÇÓÃÀ´´úÌælike "%***%"ЧÂʵÍϵÄÎÊÌâµÄ. 4.r-treeË÷Òý r-treeÔÚmysqlºÜÉÙʹÓÃ,½öÖ§³ÖgeometryÊý¾ÝÀàÐÍ,Ö§³Ö¸ÃÀàÐ͵Ĵ洢ÒýÇæÖ»ÓÐmyisam,bdb,innodb,ndb,archive¼¸ÖÖ.Ïà¶ÔÓÚb-tree,r-treeµÄÓÅÊÆÔÚÓÚ·¶Î§²éÕÒ. ¶þ:mysqlÀïsqlÓï¾äÖµµÃ×¢ÒâµÄµØ·½ 1.myisamÀïËùÒÔ¼üµÄ³¤¶È½öÖ§³Ö1000×Ö½Ú,innodbÊÇ767. 2.blobºÍtext×ֶνöÖ§³Öǰ׺Ë÷Òý. 3.ʹÓÃ!=ÒÔ¼°<>²»µÈÓÚµÄʱºòmysql²»Ê¹ÓÃË÷Òý. 4.µ±ÔÚ×Ö¶Îʱºòº¯ÊýµÄʱºò,mysqlÎÞ·¨Ê¹ÓÃË÷Òý,ÔÚjoinµÄʱºòÌõ¼þ×Ö¶ÎÀàÐͲ»Ò»ÖµÄʱºò,mysqlÎÞ·¨Ê¹ÓÃË÷Òý,ÔÚ×éºÏË÷ÒýÀïʹÓ÷ǵÚÒ»¸öË÷ÒýʱҲ²»Ê¹ÓÃË÷Òý. 5.ÔÚʹÓÃlikeµÄʱºò,ÒÔ%¿ªÍ·,¼´"%***"µÄʱºòÎÞ·¨Ê¹ÓÃË÷Òý,ÔÚʹÓÃorµÄʱºò,ÒªÇóorÇ°ºó×ֶζ¼ÓÐË÷Òý. ÓÐʱºòmysql query optimizer»áÈÏΪʹÓÃË÷Òý²¢²»ÊÇ×îÓżƻ®,ËùÒÔ²»Ê¹ÓÃË÷Òý,¿ÉÒÔÔÚsqlÓï¾äÀï¿ÉÒÔÓÃuse,force index,µ±È»ÓÐʱºòʹÓÃÒ²²»»á±È²»Óÿì,ËùÒÔÐèÒªºö
1.ʲôÊÇUDF? UDF(user-defined function)ÊÇmysqlΪÓû§ÌṩµÄ×Ô¶¨Ò庯ÊýµÄÀ©Õ¹½Ó¿Ú¡£Ëü±¾ÖÊÉϺÍmysqlÌṩµÄmax¡¢minºÍcountµÈº¯ÊýÀàËÆ¡£ 2.UDF¿ÉÒÔ×öʲô? UDFÊÇ×Ô¶¨Ò庯Êý£¬ËùÒÔËüÄÜ×öʲôÍêÈ«È¡¾öÓÚÄãµÄʵÏÖ¡£UDF¿ÉÒÔÔÚÆÕͨµÄsql¡¢triggerÒÔ¼°store procedure±»µ÷ÓᣠÈç¹û×Ô¶¨ÒåÒ»¸ötcp_send(ip,port,msg)µ ......
windows2003----¿ªÊ¼----ÔËÐÐ---mysql -uroot -p£¬½øÈëMYSQLÊý¾Ý¿â£¬ÊäÈëÃÜÂ룬µÇ½¡£
show databases;¿´¿´ÓÐÄÄЩÊý¾Ý¿â
use xxxxxx£»(xxxxxxΪÊý¾Ý¿âÃû£¬½øÈëÊý¾Ý¿â)
update user set passwd=MD5('111111*') where user_name = 'admin';£¨111111ΪҪÐ޸ĵÄÃÜÂ룩 ......