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

MySQLÀィÁ¢Ë÷ÒýÓ¦¸Ã¿¼ÂÇÊý¾Ý¿âÒýÇæµÄÀàÐÍ

 Ç°Ò»Ö±Ã»×¢ÒâÕâÒ»µã£¬Í»È»Ò»ÉÁÄîÏëÆðÀ´£¬ÏÂÃæßëß룺
±È·½ËµÓÐÒ»¸öÎÄÕÂ±í£¬ÎÒÃÇҪʵÏÖij¸öÀà±ðÏ°´Ê±¼äµ¹ÐòÁбíÏÔʾ¹¦ÄÜ£º
SELECT * from articles WHERE category_id = … ORDER BY created DESC LIMIT …
ÕâÑùµÄ²éѯºÜ³£¼û£¬»ù±¾Éϲ»¹ÜʲôӦÓÃÀﶼÄÜÕÒ³öÒ»´ó°ÑÀàËƵÄSQLÀ´£¬Ñ§ÔºÅɵĶÁÕß¿´µ½ÉÏÃæµÄSQL£¬¿ÉÄÜ»á˵SELECT *²»ºÃ£¬Ó¦¸Ã½ö½ö²éѯÐèÒªµÄ×ֶΣ¬ÄÇÎÒÃǾÍË÷ÐÔ³¹µ×µã£¬°ÑSQL¸Ä³ÉÈçϵÄÐÎʽ£º
SELECT id from articles WHERE category_id = … ORDER BY created DESC LIMIT …
ÎÒÃǼÙÉèÕâÀïµÄidÊÇÖ÷¼ü£¬ÖÁÓÚÎÄÕµľßÌåÄÚÈÝ£¬¿ÉÒÔ¶¼±£´æµ½memcachedÖ®ÀàµÄ¼üÖµÀàÐ͵Ļº´æÀÈç´ËÒ»À´£¬Ñ§ÔºÅɵĶÁÕßÃÇÓ¦¸ÃÌô²»³öʲô벡À´ÁË£¬ÏÂÃæÎÒÃǾͰ´ÕâÌõSQLÀ´¿¼ÂÇÈçºÎ½¨Á¢Ë÷Òý£º
²»¿¼ÂÇÊý¾Ý·Ö²¼Ö®ÀàµÄ¾ßÌåÇé¿ö£¬ÈκÎÒ»¸öºÏ¸ñµÄWEB¿ª·¢ÈËÔ±¶¼ÖªµÀÀàËÆÕâÑùµÄSQL£¬Ó¦¸Ã½¨Á¢Ò»¸ö”category_id, created“¸´ºÏË÷Òý£¬µ«ÕâÊÇ×î¼Ñ´ð°¸²»£¿²»¼ûµÃ£¬ÏÖÔÚÊÇ»ØÍ·¿´¿´±êÌâµÄʱºòÁË£ºMySQLÀィÁ¢Ë÷ÒýÓ¦¸Ã¿¼ÂÇÊý¾Ý¿âÒýÇæµÄÀàÐÍ£¡
Èç¹ûÎÒÃǵÄÊý¾Ý¿âÒýÇæÊÇInnoDB£¬ÄÇô½¨Á¢”category_id, created“¸´ºÏË÷ÒýÊÇ×î¼Ñ´ð°¸¡£ÈÃÎÒÃÇ¿´¿´InnoDBµÄË÷Òý½á¹¹£¬ÔÚInnoDBÀË÷Òý½á¹¹ÓÐÒ»¸öÌØÊâµÄµØ·½£º·ÇÖ÷¼üË÷ÒýÔÚÆäBTreeµÄÒ¶½ÚµãÉÏ»á¶îÍâ±£´æ¶ÔÓ¦Ö÷¼üµÄÖµ£¬ÕâÑù×öÒ»¸ö×îÖ±½ÓµÄºÃ´¦¾ÍÊÇCovering Index£¬²»ÓÃÔÙµ½Êý¾ÝÎļþÀïȥȡidµÄÖµ£¬¿ÉÒÔÖ±½ÓÔÚË÷ÒýÀïµÃµ½Ëü¡£
Èç¹ûÎÒÃǵÄÊý¾Ý¿âÒýÇæÊÇMyISAM£¬ÄÇô½¨Á¢”category_id, created”¸´ºÏË÷Òý¾Í²»ÊÇ×î¼Ñ´ð°¸¡£ÒòΪMyISAMµÄË÷Òý½á¹¹À·ÇÖ÷¼üË÷Òý²¢Ã»ÓжîÍâ±£´æ¶ÔÓ¦Ö÷¼üµÄÖµ£¬´ËʱÈç¹ûÏëÀûÓÃÉÏCovering Index£¬Ó¦¸Ã½¨Á¢”category_id, created, id”¸´ºÏË÷Òý¡£
ßëÍêÁË£¬Ó¦¸ÃÃ÷°×ÎÒµÄÒâ˼ÁË°É¡£Ï£ÍûÒÔºó´ó¼ÒÔÚ¿¼ÂÇË÷ÒýµÄʱºòÄÜ˼¿¼µÄ¸üÈ«ÃæÒ»µã£¬Êµ¼ÊÓ¦ÓÃÖл¹ÓкܶàÀàËƵÄÎÊÌ⣬±ÈÈç˵¶àÊýÈËÔÚ½¨Á¢Ë÷ÒýµÄʱºò²»´ÓCardinality£¨SHOW INDEX from …ÄÜ¿´µ½´Ë²ÎÊý£©µÄ½Ç¶È¿´ÊÇ·ñºÏÊʵÄÎÊÌ⣬ÕâЩϸ½ÚÎÊÌâÐèÒª¶ÁÕß×Ô¼º¶à×¢Ò⣬ÎҾͲ»¶à˵ÁË¡£


Ïà¹ØÎĵµ£º

ÐÞ¸ÄmysqlÃÜÂëµÄ·½·¨

use mysql
update user set Password=password('newpassword') where User='root';
flush privileges;
1.ͨ¹ýÐÞ¸ÄMYSQLÊý¾Ý¿âÖÐMYSQL¿âµÄUSER±í
¾ÍÓÃÆÕͨµÄUPDATE¡¢INSERTÓï¾ä¾Í¿ÉÒÔ
2.ÔÚÃüÁîÐÐÖÐʹÓÃÈçÏÂÃüÁî
MYSQLADMIN -u root -p PASSWORD mypasswd
3.¿ÉÒÔÐÞ¸ÄMYSQLÎļþ¼ÐÖеÄMY.INIÎļþ
4.ʹÓÃSET PASSWORDÓï¾ ......

Mysql±àÒë°²×°²ÎÊýÓÅ»¯

 1. -static  13%
   --with-client-ldflags=-all-static
   --with-mysqld-ldflags=-all-static
¾²Ì¬Á´½ÓÌá¸ß13%ÐÔÄÜ
2. -pgcc  1%
   CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc \
     CXXFLAGS="-O3 -mpentiumpro -mstack-alig ......

ʹÓÃMYSQLÊý¾Ý¿â²åÈëͼƬʱ¹ØÓÚÊý¾Ý¿â×Ö·û¼¯µÄ´íÎó

 ÔÚʹÓÃJDBC²Ù×÷Êý¾Ý¿â ÔÚÏòÊý¾Ý¿âÖвåÈëͼƬʱ£¬³ÌÐòÀÏÊÇÅ×Òì³£
Ô­À´µÄMYSQL×Ö·û¼¯ÊÇGBK  µ«ÊÇÕâÖÖ×Ö·û¼¯ËäȻ֧³ÖÖÐÎÄ µ«Êǵ±²åÈëͼƬµÈ¶þ½øÖÆÊý¾Ýʱ »á³öÏÖ´íÎó
½â¾ö·½·¨£º
½«Êý¾Ý¿â×Ö·û¼¯¸ü¸ÄΪgb2312»òutf-8
1.ÔÚMYSQL DOS½çÃæÖÐÊäÈë  show  variables  like "%char%";
+---- ......

½éÉÜmysqlÊý¾Ý¿âÏÂshowÃüÁîµÄÖ÷ÒªÓ÷¨


¡¡¡¡
¡¡¡¡±¾ÎÄÖ÷Òª½éÉÜmysqlÊý¾Ý¿âÏÂshowÃüÁîµÄÖ÷ÒªÓ÷¨£º
¡¡¡¡a. show tables»òshow tables from database_name; -- ÏÔʾµ±Ç°Êý¾Ý¿âÖÐËùÓбíµÄÃû³Æ¡£
¡¡¡¡b. show databases; -- ÏÔʾmysqlÖÐËùÓÐÊý¾Ý¿âµÄÃû³Æ¡£
¡¡¡¡c. show columns from table_name from database_name; »òshow columns from database_name.table_n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ