mysql Êý¾Ý¿â´óС
information_schema¿âÖаüº¬Á˶ÔÕû¸öÊý¾Ý¿âµÄºÜ¶àͳ¼ÆÐÅÏ¢£¬¿ÉÒÔͨ¹ý²é¿´ËüÃÇ£¬À´µÃµ½Êý¾Ý¿âÏà¹ØµÄÐÅÏ¢¡£
mysql> use information_schema;
Database changed
mysql> select count(1) as tables, concat(round(sum(table_rows)/1000000,2),'M') as rows, concat(round(sum(data_length)/(1024*1024*1024),2),'G') as data, concat(round(sum(index_length)/(1024*1024*1024),2),'G') as idx, concat(round(sum(data_length+index_length)/(1024*1024*1024),2),'G') as total_size,round(sum(index_length)/sum(data_length),2) as idxfrac from tables;
+--------+--------+--------+-------+------------+---------+
| tables | rows | data | idx | total_size | idxfrac |
+--------+--------+--------+-------+------------+---------+
| 719 | 96.41M | 30.17G | 9.63G | 39.80G | 0.32 |
+--------+--------+--------+-------+------------+---------+
1 row in set (1 min 9.64 sec)
Ïà¹ØÎĵµ£º
MySQLµÄ¶þ½øÖÆÈÕÖ¾¿ÉÒÔ˵»òÊÇMySQL×îÖØÒªµÄÈÕÖ¾ÁË,Ëü¼Ç¼ÁËËùÓеÄDDLºÍDML(³ýÁËÊý¾Ý²éѯÓï¾ä)Óï¾ä,ÒÔʼþÐÎʽ¼Ç¼,»¹°üº¬Óï¾äËùÖ´ÐеÄÏûºÄµÄʱ¼ä,MySQLµÄ¶þ½øÖÆÈÕÖ¾ÊÇʧÎó°²È«Ð͵Ä.
ÔÚ5.1µÄ°æ±¾Äã¶þ½øÖÆÈÕÖ¾»¹Ìæ´úÁËÔ±¾µÄ¸üÐÂÈÕÖ¾.Ò»°ãÀ´Ëµ¿ªÆô¶þ½øÖÆÈÕÖ¾´ó¸Å»áÓÐ1%µÄÐÔÄÜËðºÄ(²Î¼ûMySQL¹Ù·½ÖÐÎÄÊÖ²á5.1.24°æ).¶þ½øÖÆÓÐÁ½ ......
ĬÈÏÇé¿öÏÂLinuxÄÚµÄmysqlÊý¾Ý¿âmysql£¬user±íÄÚµÄÓû§È¨ÏÞÖ»ÊǶÔlocalhost¼´±¾»ú²ÅÄܵǽ¡£ÐèÒª¸ü¸ÄȨÏÞ£º
Èçϵķ½Ê½È·ÈÏ£º
root#mysql -h localhost-u mysql -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connectio ......
mysql Ŀ¼Ï嵀 my.ini ÓÐÁ½´¦ÒªÐÞ¸Ä Ò»´¦ÊÇ [mysql] default-character-set=gbk »¹ÓÐÒ»´¦ÊÇ·ñÈϽ¨±íʱʹÓõÄ×Ö·û¼¯ default-character-set=gbk Á½´¦ÐÞ¸Äһϣ¬ÖØÐ½¨Á¢Êý¾Ý¿âºÍ±íºó¾Í²»»á³öÏÖÂÒÂëÁË¡£ ½¨±íʱҲ¿ÉÒÔÖ¸¶¨Êý¾Ý¿â»ò±íËùʹÓõÄ×Ö·û¼¯ Èç¹û²»ÄÜÖØ½¨Êý¾Ý¿âÔòÖ»ÄÜÔÚÖ¸¶¨µÄÊý¾Ý¿âĿ¼Ï°ѶÔÓ¦µÄ db.opt À ......
½øÈëMySQL:mysql -u root -p password;
Í˳öMySQL:quit/exit;
´´½¨Êý¾Ý¿â£ºcreate database database-name;
ÏÔʾËùÓеÄÊý¾Ý¿â: show databases; ×¢ÒâÓиös;
ɾ³ýÊý¾Ý¿â£ºdrop database databasename;
lÁ¬½ÓÊý¾Ý¿â£ºuse databasename;Ìáʾ£ºdatabase changed;
Ñ¡Ôñµ±Ç°Êý¾Ý¿â£ºselect database();
µ±Ç°Êý¾Ý¿âËù°üº¬µÄ ......
1.ÔÚWINDOWÏ£¬¼Ç¼Êý¾ÝµÄÎı¾Îļþ±ØÐë²»ÄÜÒÔÖÐÎÄÃüÃû£¨ÃüÁîÐнçÃæÎÞ·¨ÊäÈëÖÐÎÄ£©£¬ÇÒÐè±£´æÔÚ´ÅÅ̸ùĿ¼Ï¡£
2.×Ö¶ÎÖµÖ®¼ä±ØÐëÒªÒÔLOAD DATAÃüÁîÖÐÖ¸¶¨µÄ·Ö¸ô·û·Ö¸ô£¬Ä¬ÈÏΪTAB£¬·ñÔò²»Ê¶±ð£¬Ôì³É¸Ã×Ö¶ÎֵΪNULL¡£
3.ֵΪ¿ÕµÄ×ֶΣ¬ÔÚÎı¾ÎļþÀï¿ÉÒÔÉèΪ¿Õ£¬Ò²¿ÉÒÔÉèΪ\N.
4.WINDOWÏ£¬²»¼Ó"LINES TERMINATED BY ' ......