Á˽âMySQLÊý¾Ý¿âËø¶¨»úÖÆ
Èç¹ûÒªÁ˽âMySQLÊý¾Ý¿âËø¶¨»úÖÆ£¬Ê×ÏÈÁ˽âÒ»ÏÂMySQLµÄÈýÖÖËø¶¨ÀàÐÍ£º
Ò»£¬Ðм¶Ëø¶¨
¶þ£¬±í¼¶Ëø¶¨
Èý£¬Ò³¼¶Ëø¶¨
ÕâÈýÖÖËø¶¨ÀàÐÍ£¬ÔÚMySQLÊý¾Ý¿âÖÐʹÓÃÈçÏ£º
Ðм¶Ëø¶¨£ºMyISAM£¬Memory£¬CSV[·ÇÊÂÎñÐԵĴ洢ÒýÇæ]
±í¼¶Ëø¶¨£ºInnoDB£¬NDB Chuster
Ò³¼¶Ëø¶¨£ºBerkeley DB
Á½ÖÖËø¶¨»úÖÆ£º¶ÁËø¶¨ºÍдËø¶¨
MySQLÊý¾Ý¿âËø¶¨ÐÅÏ¢²éѯ
Ò»£¬²éѯ±í¼¶Ëø¶¨µÄÐÅÏ¢[MyISAM]
mysql > SHOW STATUS LIKE 'table%';
¶þ£¬²éѯÐм¶Ëø¶¨µÄÐÅÏ¢[InnoDB]
mysql > SHOW STATUS LIKE 'innodb_row_lock%';
MySQLÊý¾Ý¿âËø¶¨±íSQL
Ò»£¬Ëø¶¨±í
¶ÁËø¶¨£ºmysql > LOCK TABLE [tablename] READ;
дËø¶¨£ºmysql > LOCK TABLE [tablename] WRITE;
½â³ýËø¶¨£ºmysql > UNLOCK TABLES;
MySQLËÀËøʵÀý[¸÷¸ö²½Öè]
µÚÒ»²½£º½ø³ÌÒ»
mysql > UPDATE t1 SET id=100 WHERE id=1;
µÚ¶þ²½£º½ø³Ì¶þ
mysql > UPDATE t2 SET id=1000 WHERE id=100;
µÚÈý²½£º½ø³ÌÒ»
mysql > UPDATE t1 SET id=2000 WHERE id=100;
µÚËIJ½£º½ø³Ì¶þ
mysql > UPDATE t2 SET id=200 WHERE id=1;
ÒÔÉϾÍÊÇһЩMySQLÊý¾Ý¿âËø¶¨»úÖƵÄС֪ʶ£¬ÕûÀíһϣ¬±ãÓÚ²éÔÄ¡£¾ßÌå½éÉÜ¿ÉËÑË÷¹Ø¼ü×Ö[ÇáËÉÕÆÎÕMySQLÊý¾Ý¿âËø»úÖƵÄÏà¹ØÔÀí]Á˽â¸ü¶àµÄ֪ʶ¡£
Ïà¹ØÎĵµ£º
MySQL²éѯ±íÄÚÖظ´¼Ç¼
²éѯ¼°É¾³ýÖظ´¼Ç¼µÄ·½·¨
(Ò»)
1¡¢²éÕÒ±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨peopleId£©À´ÅжÏ
select * from people
where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)
2¡¢É¾³ý±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΠ......
Ò»¡¢MySQL »ñµÃµ±Ç°ÈÕÆÚʱ¼ä º¯Êý
1.1 »ñµÃµ±Ç°ÈÕÆÚ+ʱ¼ä£¨date + time£©º¯Êý£ºnow()
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2008-08-08 22:20:46 |
+---------------------+
³ýÁË now() º¯ÊýÄÜ»ñµÃµ±Ç°µÄÈÕÆÚʱ¼äÍ⣬MySQL Öл¹ÓÐÏÂÃæµÄº¯Êý£º
......
Óöµ½Ò»¸öÎÊÌâÊÇÔÚMySQLÃüÁîÐвåÈëÖÐÎÄÊý¾Ý»òÕß²éѯÖÐÎÄÊý¾Ýʱ³öÏÖÂÒÂ룬»òÕßÏÔʾ²»¶Ô¡£
ÔÚÃüÁîÐÐÊäÈë:show variables like ‘character_set_%’;
²é¿´µ±Ç°ÅäÖõıàÂ룻
ÔÚÃüÁîÐÐÊäÈë :set names utf8;
ÔòµÈͬÓÚ
set character_set_client=utf8;
set character_set_results ......
½â¾öThe‘InnoDB’feature is disabled; you need MySQL built with ‘InnoDB’ to have it2009Äê12ÔÂ29ÈÕ ÐÇÆÚ¶þ ÉÏÎç 11:15MySQL
³öÏÖÈçÏÂÓï¾ä£ºThe ‘InnoDB’ feature is disabled; you need MySQL built with ‘InnoDB’ to have it working£»
ÊÇmysqlÅäÖÃÎļþ½ûµôÁËÕâ¸öÑ¡ ......
½ñÌìÎÒÃÇ¿´¿´¹ØÓÚMySQLÂýÈÕÖ¾µÄÔĶÁ¡£
ÎÒÃÇÖªµÀ£¬Èç¹ûÎÒÃǵÄÓï¾ä²»¹»ÓÅ»¯£¬ÄÇôÊ×ÏÈMySQLµÄÂýÈÕÖ¾ÊǽøÒ»²½ÓÅ»¯µÄÀëÏßÖ¤¾Ý£¬ËäÈ»ÀïÃæÓкÃ
¶à“αÂýÓï¾ä”£¡
ÏȲ»ËµÔõôÓÅ»¯£¬Èç¹ûÄãµÄÈÕÖ¾ÓÐÒ»ÌõÓï¾ä¶ÄסÁË£¬ÄÇô»áÓв»¼ÆÆäÊýµÄÂýÓï¾äÌî³äµ½MySQLµÄÂúÈÕÖ¾ÀïÃæ¡£ÄÇôÊ×ÏÈÌáÁ¶³öÕâЩÓï
¾ä¾Í·Ç³£Í·ÌÛ¡£
½ñÌìÖ÷Òª½ ......