mysql Ë÷Òý key µÄÓ÷¨
mysql> desc aa;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
| xx | int(11) | YES | PRI | NULL | |
+-------+---------+------+-----+---------+-------+
| yy | int(11) | YES | UNI | NULL | |
+-------+---------+------+-----+---------+-------+
| zz | int(11) | YES | MUL | NULL | |
+-------+---------+------+-----+---------+-------+
1 row in set (0.00 sec)
[/PHP]
ÎÒÃÇ¿´µ½KeyÄÇÒ»À¸£¬¿ÉÄÜ»áÓÐ4ÖÖÖµ£¬¼´'ɶҲûÓÐ','PRI','UNI','MUL'
1. Èç¹ûKeyÊÇ¿ÕµÄ, ÄÇô¸ÃÁÐÖµµÄ¿ÉÒÔÖظ´, ±íʾ¸ÃÁÐûÓÐË÷Òý, »òÕßÊÇÒ»¸ö·ÇΨһµÄ¸´ºÏË÷ÒýµÄ·ÇÇ°µ¼ÁÐ
2. Èç¹ûKeyÊÇPRI, ÄÇô¸ÃÁÐÊÇÖ÷¼üµÄ×é³É²¿·Ö
3. Èç¹ûKeyÊÇUNI, ÄÇô¸ÃÁÐÊÇÒ»¸öΨһֵË÷ÒýµÄµÚÒ»ÁÐ(Ç°µ¼ÁÐ),²¢±ð²»Äܺ¬ÓпÕÖµ(NULL)
4. Èç¹ûKeyÊÇMUL, ÄÇô¸ÃÁеÄÖµ¿ÉÒÔÖظ´, ¸ÃÁÐÊÇÒ»¸ö·ÇΨһË÷ÒýµÄÇ°µ¼ÁÐ(µÚÒ»ÁÐ)»òÕßÊÇÒ»¸öΨһÐÔË÷ÒýµÄ×é³É²¿·Öµ«ÊÇ¿ÉÒÔº¬ÓпÕÖµNULL
Èç¹û¶ÔÓÚÒ»¸öÁеĶ¨Ò壬ͬʱÂú×ãÉÏÊö4ÖÖÇé¿öµÄ¶àÖÖ£¬±ÈÈçÒ»¸öÁмÈÊÇPRI,ÓÖÊÇUNI
ÄÇô"desc ±íÃû"µÄʱºò£¬ÏÔʾµÄKeyÖµ°´ÕÕÓÅÏȼ¶À´ÏÔʾ PRI->UNI->MUL
ÄÇô´Ëʱ£¬ÏÔʾPRI
Ò»¸öΨһÐÔË÷ÒýÁпÉÒÔÏÔʾΪPRI,²¢ÇÒ¸ÃÁв»Äܺ¬ÓпÕÖµ£¬Í¬Ê±¸Ã±íûÓÐÖ÷¼ü
Ò»¸öΨһÐÔË÷ÒýÁпÉÒÔÏÔʾΪMUL, Èç¹û¶àÁй¹³ÉÁËÒ»¸öΨһÐÔ¸´ºÏË÷Òý
ÒòΪËäÈ»Ë÷ÒýµÄ¶àÁÐ×éºÏÊÇΨһµÄ£¬±ÈÈçID+NAMEÊÇΨһµÄ£¬µ«ÊÇûһ¸öµ¥¶ÀµÄÁÐÒÀÈ»¿ÉÒÔÓÐÖظ´µÄÖµ
Ö»ÒªID+NAMEÊÇΨһµÄ¼´¿É
Ïà¹ØÎĵµ£º
MySqlÊý¾Ý¿âµÄÁÐÀàÐÍ£¨×Ö¶ÎÀàÐÍ)
MySQLÊý¾Ý¿âµÄ±íÊÇÒ»¸ö¶þά±í£¬ÓÉÒ»¸ö»ò¶à¸öÊý¾ÝÁй¹³É¡£
ÿ¸öÊý¾ÝÁж¼ÓÐËüµÄÌض¨ÀàÐÍ£¬¸ÃÀàÐ;ö¶¨ÁËMySQLÈçºÎ¿´´ý¸ÃÁÐÊý¾Ý£¬ÎÒÃÇ¿ÉÒÔ°ÑÕûÐÍÊýÖµ´æ·Åµ½×Ö·ûÀàÐ͵ÄÁÐÖУ¬MySQLÔò»á°ÑËü¿´³É×Ö·û´®À´´¦Àí¡£
MySQLÖеÄÁÐÀàÐÍÓÐÈýÖÖ£ºÊýÖµÀà¡¢×Ö·û´®ÀàºÍÈÕÆÚ/ʱ¼äÀà¡£
´Ó´óÀàÀ´¿´ÁÐÀàÐͺÍÊýÖ ......
³£¼ûµÄMySQLÃüÁî´óÈ«
Ò»¡¢Á¬½ÓMySQL
¸ñʽ£º mysql -hÖ÷»úµØÖ· -uÓû§Ãû £pÓû§ÃÜÂë
1¡¢Àý1£ºÁ¬½Óµ½±¾»úÉϵÄMYSQL¡£
Ê×ÏÈÔÚ´ò¿ªDOS´°¿Ú£¬È»ºó½øÈëĿ¼ mysqlbin£¬ÔÙ¼üÈëÃüÁîmysql ......
1¡¢´´½¨mysqlÊý¾Ý¿âµÄ¹ÜÀíÓû§
Êý¾Ý¿â°²×°ºÃºó£¬ÎÒÃÇÓ¦¸ÃΪmysqlÊý¾Ý¿â´´½¨Ò»¸ö¹ÜÀíÕʺš£Òª°ÑrootÓû§ÉèÖÃΪ¹ÜÀíÔ±£¬´ËʱÐèÒªÖ´ÐÐÏÂÃæÃüÁ
[root@CDS2 bin]# /usr/bin/mysqladmin -u root password 123456
˵Ã÷£ºÉÏÃæ´´½¨µÄmysqlÊý¾Ý¿â¹ÜÀíԱΪroot£¬ÃÜÂë123456
2¡¢´´½¨Ò»°ãµÄÓû§
¹¤×÷ÖÐÓõ½web·þÎñÆ÷ºÍmysql·þÎñÆ ......
mysql> use information_schema
Database changed
mysql> select concat(round(sum(index_LENGTH)/(1024*1024),2),'MB') as 'Data Size' from tables where table_schema='bbs';
+-----------+
| Data Size |
+-----------+
| 0.00MB |
+-----------+
1 row in set (0.01 sec)
½âÊÍ£º
......