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

MysqlÓÅ»¯·½°¸Ö®Ë÷ÒýµÄʹÓÃ

 
Ë÷ÒýÓÃÓÚ¿ìËÙÕÒ³öÔÚij¸öÁÐÖÐÓÐÒ»Ìض¨ÖµµÄÐС£²»Ê¹ÓÃË÷Òý£¬MySQL±ØÐë´ÓµÚ1Ìõ¼Ç¼¿ªÊ¼È»ºó¶ÁÍêÕû¸ö±íÖ±µ½ÕÒ³öÏà¹ØµÄÐС£±íÔ½´ó£¬»¨·ÑµÄʱ¼äÔ½¶à¡£Èç¹û±íÖвéѯµÄÁÐÓÐÒ»¸öË÷Òý£¬MySQLÄÜ¿ìËÙµ½´ïÒ»¸öλÖÃÈ¥ËÑÑ°µ½Êý¾ÝÎļþµÄÖм䣬ûÓбØÒª¿´ËùÓÐÊý¾Ý¡£Èç¹ûÒ»¸ö±íÓÐ1000ÐУ¬Õâ±È˳Ðò¶ÁÈ¡ÖÁÉÙ¿ì100±¶¡£×¢ÒâÈç¹ûÄãÐèÒª·ÃÎʴ󲿷ÖÐУ¬Ë³Ðò¶ÁÈ¡Òª¿ìµÃ¶à£¬ÒòΪ´ËʱÎÒÃDZÜÃâ´ÅÅÌËÑË÷¡£
 
´ó¶àÊýMySQLË÷Òý(PRIMARY KEY¡¢UNIQUE¡¢INDEXºÍFULLTEXT)ÔÚBÊ÷Öд洢¡£Ö»ÊÇ¿Õ¼äÁÐÀàÐ͵ÄË÷ÒýʹÓÃR-Ê÷£¬²¢ÇÒMEMORY±í»¹Ö§³ÖhashË÷Òý¡£
 
×Ö·û´®×Ô¶¯µØѹËõǰ׺ºÍ½áβ¿Õ¸ñ¡£
 
×ܵÄÀ´Ëµ£¬°´ºóÃæµÄÌÖÂÛʹÓÃË÷Òý¡£±¾½Ú×îºóÃèÊöhashË÷Òý(ÓÃÓÚMEMORY±í)µÄÌØÕ÷¡£
 
Ë÷ÒýÓÃÓÚÏÂÃæµÄ²Ù×÷£º
 
·         ¿ìËÙÕÒ³öÆ¥ÅäÒ»¸öWHERE×Ó¾äµÄÐС£
 
·         ɾ³ýÐС£Èç¹û¿ÉÒÔÔÚ¶à¸öË÷ÒýÖнøÐÐÑ¡Ôñ£¬MySQLͨ³£Ê¹ÓÃÕÒµ½×îÉÙÐеÄË÷Òý¡£
 
·         µ±Ö´ÐÐÁª½Óʱ£¬´ÓÆäËü±í¼ìË÷ÐС£
 
·         ¶Ô¾ßÌåÓÐË÷ÒýµÄÁÐkey_colÕÒ³öMAX()»òMIN()Öµ¡£ÓÉÔ¤´¦ÀíÆ÷½øÐÐÓÅ»¯£¬¼ì²éÊÇ·ñ¶ÔË÷ÒýÖÐÔÚkey_col֮ǰ·¢ÉúËùÓйؼü×ÖÔªËØʹÓÃÁËWHERE key_part_# = constant¡£ÔÚÕâÖÖÇé¿öÏ£¬MySQLΪÿ¸öMIN()»òMAX()±í´ïʽִÐÐÒ»´Î¹Ø¼ü×Ö²éÕÒ£¬²¢Óó£ÊýÌæ»»Ëü¡£Èç¹ûËùÓбí´ïʽÌ滻Ϊ³£Á¿£¬²éѯÁ¢¼´·µ»Ø¡£ÀýÈ磺
 
·                SELECT MIN(key_part2),MAX(key_part2)
·                    from tbl_name WHERE key_part1=10;
·         Èç¹û¶ÔÒ»¸ö¿ÉÓùؼü×ÖµÄ×î×óÃæµÄǰ׺½øÐÐÁËÅÅÐò»ò·Ö×é(ÀýÈ磬ORDER BY key_part_1,key_part_2)£¬ÅÅÐò»ò·Ö×éÒ»¸ö±í¡£Èç¹ûËùÓйؼü×ÖÔªËغóÃæÓÐDESC£¬¹Ø¼ü×ÖÒÔµ¹Ðò±»¶ÁÈ¡¡£
·         ÔÚһЩÇé¿öÖУ¬¿ÉÒÔ¶ÔÒ»¸ö²éѯ½øÐÐÓÅ»¯ÒԱ㲻ÓòéѯÊý¾ÝÐм´¿ÉÒÔ¼ìË÷Öµ¡£Èç¹û²éѯֻʹÓÃÀ´×Ôij¸ö±íµÄÊý×ÖÐͲ¢ÇÒ¹¹³ÉÄ


Ïà¹ØÎĵµ£º

½â¾öÈçºÎÐÞ¸Ämysql·þÎñÆ÷¼àÌý¶Ë¿ÚµÄÎÊÌâ

 1£©Èç¹ûÄã°²×°µÄÊÇϵͳ×Ô´øµÄrpm°üµÄÇé¿ö£º
ÐÞ¸Ä /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
port=3300                    #Ð޸ijÉÄã×Ô¼ºÏëÒªµÄ¶Ë¿Ú
socket=/var/lib/mysql/mysql.sock
[mysql.server]
user=mysql
basedir=/var/lib
[safe_m ......

LinuxÏÂMysql°²×°ºÍÅäÖÃ2

 LinuxÏÂmysqlµÄ°²×°²½Ö裨·Çrpm°²×°£©
1 ÏÂÔØmysql-standard-5.0.27-linux-i686-glibc23.tar.gz °ü
2 ½âѹµ½°²×°Ä¿Â¼£º tar -zxvf /edass/db/mysql-standard-5.0.27-linux-i686-glibc23.tar.gz
3 ½«  mysql-standard-5.0.27-linux-i686-glibc23Á´½Óµ½mysql : ln –s mysql-standard-5.0.27-linux-i686 ......

ÀûÓÃmysqldumpµ¼³öµ¼ÈëmysqlËùÓÐÊý¾Ý¿â


1 µ¼³ö:
½øÈëÃüÁîÐÐ: Ö´ÐÐ
mysqldump -u username -p password –all-databases > all.sql
Ïêϸ²ÎÊý:
http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html
2 µ¼Èë
½øÈëmysql -u username -p password
Ö´ÐÐsource all.sql;
......

ʹÓà MySQL Workbench ¿ÉÊÓ»¯µÄÉè¼Æ MySQL Êý¾Ý¿â

MySQL Workbench ÊÇ MySQL ×î½üÊͷŵĿÉÊÓÊý¾Ý¿âÉè¼Æ¹¤¾ß¡£Õâ¸ö¹¤¾ßÊÇÉè¼Æ MySQL Êý¾Ý¿âµÄרÓù¤¾ß¡£
ÄãÔÚ MySQL Workbench Öн¨Á¢µÄ±»³Æ֮ΪÎïÀíÊý¾ÝÄ£ÐÍ¡£Ò»¸öÎïÀíÊý¾ÝÄ£ÐÍÊÇÕë¶ÔÒ»¸öÌض¨ RDBMS ²úÆ·µÄÊý¾ÝÄ£ÐÍ£»±¾ÎÄÖеÄÄ£Ðͽ«¾ßÓÐһЩ MySQL µÄ¶ÀÌع淶¡£ÎÒÃÇ¿ÉÒÔʹÓÃËüÉú³É£¨forward-engineer£©Êý¾Ý¿â¶ÔÏ󣬳ýÁË°üº¬± ......

Mysql ʱ¼äº¯Êý»ã×Ü

 Ò»¡¢MySQL »ñµÃµ±Ç°ÈÕÆÚʱ¼ä º¯Êý
1.1 »ñµÃµ±Ç°ÈÕÆÚ+ʱ¼ä£¨date + time£©º¯Êý£ºnow()
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2008-08-08 22:20:46 |
+---------------------+
³ýÁË now() º¯ÊýÄÜ»ñµÃµ±Ç°µÄÈÕÆÚʱ¼äÍ⣬MySQL Öл¹ÓÐÏÂÃæµÄº¯Êý£º
current_tim ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ