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

mysqlÓÅ»¯¼¼ÇÉ

1¡¢Ñ¡È¡×îÊÊÓõÄ×Ö¶ÎÊôÐÔ
MySQL ¿ÉÒԺܺõÄÖ§³Ö´óÊý¾ÝÁ¿µÄ´æÈ¡£¬µ«ÊÇÒ»°ã˵À´£¬Êý¾Ý¿âÖеıíԽС£¬ÔÚËüÉÏÃæÖ´ÐеIJéѯҲ¾Í»áÔ½¿ì¡£Òò´Ë£¬ÔÚ´´½¨±íµÄʱºò£¬ÎªÁË»ñµÃ¸üºÃµÄÐÔÄÜ£¬ÎÒÃÇ¿ÉÒÔ½«±íÖÐ×ֶεĿí¶ÈÉèµÃ¾¡¿ÉÄÜС¡£ÀýÈ磬ÔÚ¶¨ÒåÓÊÕþ±àÂëÕâ¸ö×Ö¶Îʱ£¬Èç¹û½«ÆäÉèÖÃΪCHAR(255),ÏÔÈ»¸øÊý¾Ý¿âÔö¼ÓÁ˲»±ØÒªµÄ¿Õ¼ä£¬ÉõÖÁʹÓÃVARCHARÕâÖÖÀàÐÍÒ²ÊǶàÓàµÄ£¬ÒòΪCHAR(6)¾Í¿ÉÒԺܺõÄÍê³ÉÈÎÎñÁË¡£Í¬ÑùµÄ£¬Èç¹û¿ÉÒԵĻ°£¬ÎÒÃÇÓ¦¸ÃʹÓÃMEDIUMINT¶ø²»ÊÇBIGINÀ´¶¨ÒåÕûÐÍ×ֶΡ£
ÁíÍâÒ»¸öÌá¸ßЧÂʵķ½·¨ÊÇÔÚ¿ÉÄܵÄÇé¿öÏ£¬Ó¦¸Ã¾¡Á¿°Ñ×Ö¶ÎÉèÖÃΪNOT NULL£¬ÕâÑùÔÚ½«À´Ö´ÐвéѯµÄʱºò£¬Êý¾Ý¿â²»ÓÃÈ¥±È½ÏNULLÖµ¡£
¶ÔÓÚijЩÎı¾×ֶΣ¬ÀýÈç“Ê¡·Ý”»òÕß“ÐԱ𔣬ÎÒÃÇ¿ÉÒÔ½«ËüÃǶ¨ÒåΪENUMÀàÐÍ¡£ÒòΪÔÚMySQLÖУ¬ENUMÀàÐͱ»µ±×÷ÊýÖµÐÍÊý¾ÝÀ´´¦Àí£¬¶øÊýÖµÐÍÊý¾Ý±»´¦ÀíÆðÀ´µÄËÙ¶ÈÒª±ÈÎı¾ÀàÐÍ¿ìµÃ¶à¡£ÕâÑù£¬ÎÒÃÇÓÖ¿ÉÒÔÌá¸ßÊý¾Ý¿âµÄÐÔÄÜ¡£
2¡¢Ê¹ÓÃÁ¬½Ó£¨JOIN£©À´´úÌæ×Ó²éѯ(Sub-Queries)
MySQL ´Ó4.1¿ªÊ¼Ö§³ÖSQLµÄ×Ó²éѯ¡£Õâ¸ö¼¼Êõ¿ÉÒÔʹÓÃSELECTÓï¾äÀ´´´½¨Ò»¸öµ¥ÁеIJéѯ½á¹û£¬È»ºó°ÑÕâ¸ö½á¹û×÷Ϊ¹ýÂËÌõ¼þÓÃÔÚÁíÒ»¸ö²éѯÖС£ÀýÈ磬ÎÒÃÇÒª½«¿Í»§»ù±¾ÐÅÏ¢±íÖÐûÓÐÈκζ©µ¥µÄ¿Í»§É¾³ýµô£¬¾Í¿ÉÒÔÀûÓÃ×Ó²éѯÏÈ´ÓÏúÊÛÐÅÏ¢±íÖн«ËùÓз¢³ö¶©µ¥µÄ¿Í»§IDÈ¡³öÀ´£¬È»ºó½«½á¹û´«µÝ¸øÖ÷²éѯ£¬ÈçÏÂËùʾ£º
DELETE from customerinfo
WHERE CustomerID NOT in (SELECT CustomerID from salesinfo )
ʹÓÃ×Ó²éѯ¿ÉÒÔÒ»´ÎÐÔµÄÍê³ÉºÜ¶àÂß¼­ÉÏÐèÒª¶à¸ö²½Öè²ÅÄÜÍê³ÉµÄSQL²Ù×÷£¬Í¬Ê±Ò²¿ÉÒÔ±ÜÃâÊÂÎñ»òÕß±íËøËÀ£¬²¢ÇÒдÆðÀ´Ò²ºÜÈÝÒס£µ«ÊÇ£¬ÓÐЩÇé¿öÏ£¬×Ó²éѯ¿ÉÒÔ±»¸üÓÐЧÂʵÄÁ¬½Ó£¨JOIN£©.. Ìæ´ú¡£ÀýÈ磬¼ÙÉèÎÒÃÇÒª½«ËùÓÐûÓж©µ¥¼Ç¼µÄÓû§È¡³öÀ´£¬¿ÉÒÔÓÃÏÂÃæÕâ¸ö²éѯÍê³É£º
SELECT * from customerinfo
WHERE CustomerID NOT in (SELECT CustomerID from salesinfo )
Èç¹ûʹÓÃÁ¬½Ó£¨JOIN£©.. À´Íê³ÉÕâ¸ö²éѯ¹¤×÷£¬ËٶȽ«»á¿ìºÜ¶à¡£ÓÈÆäÊǵ±salesinfo±íÖжÔCustomerID½¨ÓÐË÷ÒýµÄ»°£¬ÐÔÄܽ«»á¸üºÃ£¬²éѯÈçÏ£º
SELECT * from customerinfo
LEFT JOIN salesinfoON customerinfo.CustomerID=salesinfo.
CustomerID
WHERE salesinfo.CustomerID IS NULL
Á¬½Ó£¨JOIN£©.. Ö®ËùÒÔ¸üÓÐЧÂÊһЩ£¬ÊÇÒòΪ MySQL²»ÐèÒªÔÚÄÚ´æÖд´½¨ÁÙʱ±íÀ´Íê³ÉÕâ¸öÂß¼­ÉϵÄÐèÒªÁ½¸ö²½ÖèµÄ²éѯ¹¤×÷¡£
3¡¢Ê¹ÓÃÁªºÏ(UNION)À´´úÌæÊÖ¶¯´´½¨µÄÁÙʱ±í
MySQL ´Ó 4.0 µÄ°æ±¾¿ªÊ¼Ö§³Ö UNION ²éÑ


Ïà¹ØÎĵµ£º

nagios¼à¿ØmysqlÖ÷´Ó¸´ÖÆ


ÏÂÊÖ´¦£ºµÇ½mysql´Ó·þÎñÆ÷£¬Í¨¹ýÖ´ÐÐ mysql> show slave status\G ²é¿´ÆäÊä³ö£¬¼´¿ÉÅж¨Ö÷´Ó¸´ÖÆÊÇ·ñÕý³£¡£ÏÂÃæÊǼà¿ØMYSQL¸´ÖÆij¸ö´Ó·þÎñÆ÷µÄÊä³ö£º
mysql> show slave status\G
*************************** 1. row ***************************
         &nbs ......

phpmyadminÖÐMySQLÈçºÎ¼ÓÃÜ(ÅäÖÃ)

ת×Ôhttp://blog.csdn.net/ytz_linuxer/archive/2009/07/04/4321259.aspx
ÒÔ°æ±¾phpMyAdmin-2.6.1.tar.gzΪÀý
      ÏȽâѹphpMyAdmin-2.6.1.tar.gzµ½/usr/local/apache2/htdocs£¬
µÃµ½Îļþ¼ÐphpMyAdmin-2.6.1£¬½«ÆäÖØÃüÃûΪphpmyadmin,(ÕâÑùÔÚÒÔºóµÄ²Ù×÷Öн«»á±äµÄ¼ò±ã)¡£
    ......

MySQL phpMyAdmin °²×°

Ê×ÏÈ°²×°phpMyadmin
[root@aladdin phpMyAdmin]# uname -a
Linux aladdin.leadtek.com.cn 2.6.32.11-99.fc12.i686.PAE #1 SMP Mon Apr 5 16:15:03 EDT 2010 i686 i686 i386 GNU/Linux
[root@aladdin phpMyAdmin]# yum info phpmyadmin
Loaded plugins: presto, refresh-packagekit
Installed Packages
Name &nbs ......

MYSQLÍâ¼ü(Foreign Key)µÄʹÓ㨶þ£©

×÷ÕߣºDirk (dirk.ye AT gmail.com)
Url£ºhttp://dirk.pdx.cn
ÈÕÆÚ£º2004/12/08
Ê×ÏÈ£¬Ä¿Ç°ÔÚ²úÆ·»·¾³¿ÉÓõÄMySQL°æ±¾£¨Ö¸4.0.xºÍ4.1.x£©ÖУ¬Ö»ÓÐInnoDBÒýÇæ²ÅÔÊÐíʹÓÃÍâ¼ü£¬ËùÒÔ£¬ÎÒÃǵÄÊý¾Ý±í±ØÐëʹÓÃ
InnoDBÒýÇæ¡£
ÏÂÃ棬ÎÒÃÇÏÈ´´½¨ÒÔϲâÊÔÓÃÊý¾Ý¿â
񡜧
CREATE TABLE `roottb` (
`id` INT(11) UNSIGNED AU ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ