mysqlѧϰ3
ÉÏƪÎÒÃÇѧ»áÁËÈçºÎ´´½¨Ò»¸öÊý¾Ý¿âºÍÊý¾Ý¿â±í£¬²¢ÖªµÀÈçºÎÏòÊý¾Ý¿â±íÖÐÌí¼Ó¼Ç¼¡£
ÄÇôÎÒÃÇÈçºÎ´ÓÊý¾Ý¿â±íÖмìË÷Êý¾ÝÄØ£¿
1¡¢´ÓÊý¾Ý¿â±íÖмìË÷ÐÅÏ¢
ʵ¼ÊÉÏ£¬Ç°ÃæÎÒÃÇÒѾÓõ½ÁËSELECTÓï¾ä£¬ËüÓÃÀ´´ÓÊý¾Ý¿â±íÖмìË÷ÐÅÏ¢¡£
selectÓï¾ä¸ñʽһ°ãΪ£º
SELECT ¼ìË÷¹Ø¼ü´Ê from ±»¼ìË÷µÄ±í WHERE ¼ìË÷Ìõ¼þ(¿ÉÑ¡)
ÒÔÇ°ËùʹÓõē * ”±íʾѡÔñËùÓеÄÁС£
ÏÂÃæ¼ÌÐøʹÓÃÎÒÃÇÔÚÉÏƪÎÄÕÂÖд´½¨µÄ±ímytable£º
2¡¢²éѯËùÓÐÊý¾Ý£º
mysql> select * from mytable;
+----------+------+------------+----------+
| name | | birth | birthaddr |
+----------+------+------------+--------+
| abccs |f | 1977-07-07 | china |
| mary |f | 1978-12-12 | usa |
| tom |m | 1970-09-02 | usa |
+----------+------+------------+----------+
3 row in set (0.00 sec)
3¡¢ÐÞÕý´íÎó¼Ç¼£º
¼ÙÈçtomµÄ³öÉúÈÕÆÚÓдíÎó£¬Ó¦¸ÃÊÇ1973£09£02£¬Ôò¿ÉÒÔÓÃupdateÓï¾äÀ´ÐÞÕý£º
mysql> update mytable set birth = "1973-09-02" where name = "tom";
ÔÙÓÃ2ÖеÄÓï¾ä¿´¿´ÊÇ·ñÒѸüÕý¹ýÀ´¡£
4¡¢Ñ¡ÔñÌض¨ÐÐ
ÉÏÃæÐÞ¸ÄÁËtomµÄ³öÉúÈÕÆÚ£¬ÎÒÃÇ¿ÉÒÔÑ¡ÔñtomÕâÒ»ÐÐÀ´¿´¿´ÊÇ·ñÒѾÓÐÁ˱仯£º
mysql> select * from mytable where name = "tom";
+--------+------+------------+------------+
| name | | birth | birthaddr |
+--------+------+------------+------------+
| tom |m | 1973-09-02 | usa |
+--------+------+------------+------------+
1 row in set (0.06 sec)
ÉÏÃæWHEREµÄ²ÎÊýÖ¸¶¨Á˼ìË÷Ìõ¼þ¡£ÎÒÃÇ»¹¿ÉÒÔÓÃ×éºÏÌõ¼þÀ´½øÐвéѯ£º
mysql> SELECT * from mytable WHERE = "f" AND birthaddr = "china";
+--------+------+------------+------------+
| name | | birth | birthaddr |
+--------+------+------------+------------+
| abccs |f | 1977
Ïà¹ØÎĵµ£º
LOAD DATA INFILE
ÕâÊÇÎÒÃÇÒª½éÉܵÄ×îºóÒ»¸öµ¼ÈëÊý¾Ýµ½MySQLÊý¾Ý¿âÖеķ½·¨¡£Õâ¸öÃüÁîÓëmysqlimport·Ç³£ÏàËÆ£¬µ«Õâ¸ö·½·¨¿ÉÒÔÔÚmysqlÃüÁîÐÐÖÐʹÓá£Ò²¾ÍÊÇ˵Äú¿ÉÒÔÔÚËùÓÐʹÓÃAPIµÄ³ÌÐòÖÐʹÓÃÕâ¸öÃüÁʹÓÃÕâÖÖ·½·¨£¬Äú¾Í¿ÉÒÔÔÚÓ¦ÓóÌÐòÖе¼ÈëÄúÏëÒªµ¼ÈëµÄÊý¾Ý¡£ ʹÓÃÕâ¸öÃüÁî֮ǰ£¬mysqld½ø³Ì£¨·þÎñ£©±ØÐëÒѾÔÚÔËÐ ......
°²×°·þÎñÆ÷¶Ë£ºÏÂÔØÒ»¸ömysqlµÄ°²×°³ÌÐò£¬ÎÒ°²×°µÄÊÇ5.0°æ±¾µÄ£¬°´ÕÕÌáʾһ²½²½²Ù×÷Íê³É¡£Ã»ÓÐʲôÌرð˵Ã÷µÄ¡£
°²×°¿Í»§¶Ë£ºÏÂÔØÒ»¸ömysql-query-browser£¬ÎÒÓõÄÊÇ1.1°æ±¾µÄ£¬°²×°£¬°´ÕÕÌáʾ²Ù×÷¡£
¶¼°²×°Íê³ÉÒÔºó£¬ÔÚ±¾»úÓÃbrowser²âÊÔÒ»ÏÂÊÇ·ñÄÜÁ¬µÄÉϱ¾»úµÄ·þÎñ£¬Á¬½Ó³É¹¦£¬¶¼°²×°OK.
Èç¹ûÄãÏëÈÃÆäËûµÄ¿ª·¢ÈËÔ±Ò»Æð ......
truncate table Çå¿Õ±í£¬ºÍdeleteÏàËÆ£¬µ«ÊÇÔÚ±í·Ç³£´óµÄʱºò£¬ËüÊÇÖð²½Êͷŵġ£
insert Èç¹ûÔÚ²åÈëʱ£¬Ä³¸ö×ֶδæÔÚ£¬ÎÒÏë¸üпÉÒÔͨ¹ý insert into tablename values() on duplicate key update id=id+1;
insert into tablename values(default) ĬÈÏ×ÔÔö³¤
select last_insert_id() È¡×îºó²åÈëÒ»Ìõ¡£ ......
Query Cache ÔÚÌá¸ßÊý¾Ý¿âÐÔÄÜ·½Ãæ¾ßÓзdz£ÖØÒªµÄ×÷Óá£
ÆäÉ趨Ҳ·Ç³£¼òµ¥£¬½öÐèÒªÔÚÅäÖÃÎļþдÈëÁ½ÐУº query_cache_type ºÍ query_cache _size£¬¶øÇÒ MySQL µÄ query cache ·Ç³£¿ì£¡¶øÇÒÒ»µ©ÃüÖУ¬¾ÍÖ±½Ó·¢Ë͸ø¿Í»§¶Ë£¬½ÚÔ¼´óÁ¿µÄ CPU ʱ¼ä¡£
µ±È»£¬·Ç SELECT Óï¾ä¶Ô»º³åÊÇÓÐÓ°ÏìµÄ£¬ËüÃÇ¿ÉÄÜʹ»º³åÖеÄÊý¾Ý¹ýÆÚ¡£Ò»¸ö ......