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

MySQLµÄMyISAMºÍInnoDB¶Ô±È¼°ÓÅ»¯

±¾ÎÄתÔØ×Ô£ºhttp://hi.baidu.com/xiaoxiaolq/blog/item/7984dcbf15dd030018d81f27.html 
MyISAMºÍInnoDBÊÇÔÚʹÓÃMySQL×î³£ÓõÄÁ½¸ö±íÀàÐÍ£¬¸÷ÓÐÓÅȱµã£¬ÊÓ¾ßÌåÓ¦Óöø¶¨¡£»ù±¾µÄ²î±ðΪ£ºMyISAMÀàÐͲ»Ö§³ÖÊÂÎñ´¦ÀíµÈ¸ß¼¶´¦Àí£¬¶øInnoDBÀàÐÍÖ§³Ö¡£MyISAMÀàÐ͵ıíÇ¿µ÷µÄÊÇÐÔÄÜ£¬ÆäÖ´ÐÐÊý¶È±ÈInnoDBÀàÐ͸ü¿ì£¬µ«ÊDz»ÌṩÊÂÎñÖ§³Ö£¬¶øInnoDBÌṩÊÂÎñÖ§³ÖÒѾ­Íⲿ¼üµÈ¸ß¼¶Êý¾Ý¿â¹¦ÄÜ¡£
MyIASMÊÇIASM±íµÄа汾£¬ÓÐÈçÏÂÀ©Õ¹£º
1¡¢¶þ½øÖƲã´ÎµÄ¿ÉÒÆÖ²ÐÔ¡£
2¡¢NULLÁÐË÷Òý¡£
3¡¢¶Ô±ä³¤ÐбÈISAM±íÓиüÉÙµÄËéƬ¡£
4¡¢Ö§³Ö´óÎļþ¡£
5¡¢¸üºÃµÄË÷ÒýѹËõ¡£
6¡¢¸üºÃµÄ¼üÂëͳ¼Æ·Ö²¼¡£
7¡¢¸üºÃºÍ¸ü¿ìµÄauto_increment´¦Àí¡£
InnoDB ÊÇ MySQL ÉϵÚÒ»¸öÌṩÍâ¼üÔ¼ÊøµÄÒýÇ棬³ýÁËÌṩÊÂÎñ´¦ÀíÍ⣬InnoDB »¹Ö§³ÖÐÐËø£¬ÌṩºÍ Oracle Ò»ÑùµÄÒ»ÖÂÐԵIJ»¼ÓËø¶ÁÈ¡£¬ÄÜÔö¼Ó²¢·¢¶ÁµÄÓû§ÊýÁ¿²¢Ìá¸ßÐÔÄÜ£¬²»»áÔö¼ÓËøµÄÊýÁ¿¡£
InnoDB µÄÉè¼ÆÄ¿±êÊÇ´¦Àí´óÈÝÁ¿Êý¾Ýʱ×î´ó»¯ÐÔÄÜ£¬ËüµÄ CPU ÀûÓÃÂÊÊÇÆäËûËùÓлùÓÚ´ÅÅ̵ĹØϵÊý¾Ý¿âÒýÇæÖÐ×îÓÐЧÂʵġ£
InnoDB ÊÇÒ»Ì×·ÅÔÚ MySQL ºǫ́µÄÍêÕûÊý¾Ý¿âϵͳ£¬InnoDB ÓÐËü×Ô¼ºµÄ»º³å³Ø£¬ÄÜ»º³åÊý¾ÝºÍË÷Òý£¬InnoDB »¹°ÑÊý¾ÝºÍË÷Òý´æ·ÅÔÚ±í¿Õ¼äÀïÃ棬¿ÉÄÜ°üº¬ºÃ¼¸¸öÎļþ£¬ÕâºÍ MyISAM ±íÍêÈ«²»Í¬£¬ÔÚ MyISAM ÖУ¬±í±»´æ·ÅÔÚµ¥¶ÀµÄÎļþÖУ¬InnoDB ±íµÄ´óСֻÊÜÏÞÓÚ²Ù×÷ϵͳÎļþµÄ´óС£¬Ò»°ãΪ 2GB¡£
ÒÔÏÂÊÇһЩϸ½ÚºÍ¾ßÌåʵÏֵIJî±ð£º
1¡¢InnoDB²»Ö§³ÖFULLTEXTÀàÐ͵ÄË÷Òý¡£
2¡¢InnoDB Öв»±£´æ±íµÄ¾ßÌåÐÐÊý£¬Ò²¾ÍÊÇ˵£¬Ö´ÐÐselect count(*) from tableʱ£¬InnoDBҪɨÃèÒ»±éÕû¸ö±íÀ´¼ÆËãÓжàÉÙÐУ¬µ«ÊÇMyISAMÖ»Òª¼òµ¥µÄ¶Á³ö±£´æºÃµÄÐÐÊý¼´¿É¡£×¢ÒâµÄÊÇ£¬µ±count(*)Óï¾ä°üº¬ whereÌõ¼þʱ£¬Á½ÖÖ±íµÄ²Ù×÷ÊÇÒ»ÑùµÄ¡£
3¡¢¶ÔÓÚAUTO_INCREMENTÀàÐ͵Ä×ֶΣ¬InnoDBÖбØÐë°üº¬Ö»ÓиÃ×ֶεÄË÷Òý£¬µ«ÊÇÔÚMyISAM±íÖУ¬¿ÉÒÔºÍÆäËû×Ö¶ÎÒ»Æð½¨Á¢ÁªºÏË÷Òý¡£
4¡¢DELETE from tableʱ£¬InnoDB²»»áÖØн¨Á¢±í£¬¶øÊÇÒ»ÐÐÒ»ÐеÄɾ³ý¡£
5¡¢LOAD TABLE from MASTER²Ù×÷¶ÔInnoDBÊDz»Æð×÷Óõģ¬½â¾ö·½·¨ÊÇÊ×ÏÈ°ÑInnoDB±í¸Ä³ÉMyISAM±í£¬µ¼ÈëÊý¾ÝºóÔٸijÉInnoDB±í£¬µ«ÊǶÔÓÚʹÓõĶîÍâµÄInnoDBÌØÐÔ£¨ÀýÈçÍâ¼ü£©µÄ±í²»ÊÊÓá£
6¡¢InnoDB±íµÄÐÐËøÒ²²»ÊǾø¶ÔµÄ£¬Èç¹ûÔÚÖ´ÐÐÒ»¸öSQLÓï¾äʱMySQL²»ÄÜÈ·¶¨ÒªÉ¨ÃèµÄ·¶Î§£¬InnoDB±íͬÑù»áËøÈ«±í£¬ÀýÈçupdate table set num=1 where name like “%aaa%”
MyISAMºÍInnoDBÓÅ»¯£º
key_buffer_size - Õâ¶ÔMyISAM


Ïà¹ØÎĵµ£º

ÕÒ»ØmysqlÃÜÂë

 
ÐÞÕýһϣºÎÒÔÚWindowsϵÄʵ¼Ê²Ù×÷ÈçÏÂ
1.¹Ø±ÕÕýÔÚÔËÐеÄMySQL¡£
2.´ò¿ªDOS´°¿Ú£¬×ªµ½mysql\binĿ¼¡£
3.ÊäÈëmysqld½â --skip-grant-tables»Ø³µ¡£Èç¹ûûÓгöÏÖÌáʾÐÅÏ¢£¬ÄǾͶÔÁË¡£
4.ÔÙ¿ªÒ»¸öDOS´°¿Ú£¨ÒòΪ¸Õ²ÅÄǸöDOS´°¿ÚÒѾ­²»Äܶ¯ÁË£©£¬×ªµ½mysql\binĿ¼¡£
5.ÊäÈëmysql»Ø³µ£¬Èç¹û³É¹¦£¬½«³öÏÖMySQL ......

mysqlÖ÷´ÓÊý¾Ý¸´ÖÆ

Ò»¡¢Îª´ÓÊý¾Ý¿âÉèÖø´ÖÆÕ˺Å
grant REPLICATION SLAVE on *.* To 'backup'@'%' identified by 'backuppwd'
flush privileges
 
¶þ¡¢µ¼³öÊý¾Ý
(1)Ö±½Ó¸´ÖÆÊý¾ÝÎļþĿ¼·½·¨
a. Í£Ö¹Êý¾Ý¿âдÊý¾Ý
flush tables with read lock
b.ÏÔʾ´ËʱmasterµÄ״̬
show master status
¼ÆÏ´ËʱÖ÷Êý¾Ý¿âµÄbinlogµ ......

php+mysqlÖеÄһЩÓï¾ä

mysql½¨Á¢Ò»¸ö±í¸ñ£º
create table hyhtbsc(
id int(4) primary key auto_increment,
username varchar(20),
password varchar(20)
);
²éѯÊý¾Ý¿âÄÚÈÝ£º
<?php
$conn = mysql_connect("localhost","root","pass");
mysql_select_db("mydb",$conn);
$sql = "select * from mytable";
$result = mysql_query($ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ