¹ØÓÚMySQLµÄÂýÈÕÖ¾·ÖÎö¹¤¾ß
½ñÌìÎÒÃÇ¿´¿´¹ØÓÚMySQLÂýÈÕÖ¾µÄÔĶÁ¡£
ÎÒÃÇÖªµÀ£¬Èç¹ûÎÒÃǵÄÓï¾ä²»¹»ÓÅ»¯£¬ÄÇôÊ×ÏÈMySQLµÄÂýÈÕÖ¾ÊǽøÒ»²½ÓÅ»¯µÄÀëÏßÖ¤¾Ý£¬ËäÈ»ÀïÃæÓкÃ
¶à“αÂýÓï¾ä”£¡
ÏȲ»ËµÔõôÓÅ»¯£¬Èç¹ûÄãµÄÈÕÖ¾ÓÐÒ»ÌõÓï¾ä¶ÄסÁË£¬ÄÇô»áÓв»¼ÆÆäÊýµÄÂýÓï¾äÌî³äµ½MySQLµÄÂúÈÕÖ¾ÀïÃæ¡£ÄÇôÊ×ÏÈÌáÁ¶³öÕâЩÓï
¾ä¾Í·Ç³£Í·ÌÛ¡£
½ñÌìÖ÷Òª½éÉÜÁ½ÖÖ¹¤¾ß£º
1,mysqldumpslow¡££¨ÔÛÃÇ
MySQL×Ô´øµÄ¼òµ¥¶øÓÖʵÓõŤ¾ß£©
ÎÒÃÇÏÈÀ´¿´ÏÂmysqldumpslowµÄ½á¹û¡£
[root@localhost ~]# mysqldumpslow -r
localhost-slow.log
Reading
mysql slow query log from localhost-slow.log
Count: 2 Time=7.00s (14s) Lock=0.00s (0s) Rows=0.0 (0),
root[root]@localhost
select * from t_page_sample order by id desc limit N,N
Count: 1 Time=11.00s (11s) Lock=0.00s (0s) Rows=1.0 (1),
root[root]@localhost
select count(*) from t_page_sample
Count: 1 Time=1418.00s (1418s) Lock=0.00s (0s) Rows=0.0 (0),
root[root]@localhost
insert ignore into t_page_sample select ceil(rand()*N),
ceil(rand()*N), date_sub(now(),interval floor(rand()*N) day), now() from
t_page_sample
±ÈÈçÒª²éÕÒÅÅÐòµÄÂýÓï¾ä£º
[root@localhost
~]# mysqldumpslow -r -g "order by " localhost-slow.log
Reading mysql slow query log from
localhost-slow.log
Count: 2
Time=7.00s (14s) Lock=0.00s (0s) Rows=0.0 (0), root[root]@localhost
select * from t_page_sample order by id desc limit N,N
×Ô
´øµÄmysqldumpslow¼òµ¥ÊµÓã¬×÷ΪÎÒ¸öÈ˵ÄÊ×Ñ¡¡£¹ØÓÚ¾ßÌåµÄ²ÎÊýº¬Ò壬¿ÉÒԲμûËü×ÔÉíµÄHELP¡£
2,mk-query-digest¡£(Íø
ÉÏÖøÃûµÄ¿ªÔ´½Å±¾¼Ò×åMaatkitÖÐÒ»Ô±)
ÊÖ²áµØÖ·£ºhttp://www.maatkit.org/doc/mk-
query-digest.html
ÏÂÔØ·½·¨£ºwget
http://www.maatkit.org/get/mk-query-digest
ÍêÁ˸³¸øËü¿ÉÖ´ÐÐȨÏÞ¾ÍOK¡£
mk-query-digest
¹¦ÄÜÌ«¶à£¬ÎÒ½ñÌìÖ»ÊÇÊÔÁËÏÂËü¶ÔMySQLÂýÈÕÖ¾µÄ·ÖÎö¹¦ÄÜ¡£
ÒÔÏÂÊÇÎÒ¾õµÃ±È½ÏʵÓõŦÄÜ¡£
1£©·ÖÎöÂýÈÕÖ¾²¢ÇÒ°ÑÕÒ³öÀ´µÄÓï¾äдµ½¹æ¶¨µÄ
±íÀï¡£
[root@localhost ~]#
./mk-query-digest --limit 2 --select
Query_time,Lock_time,Rows_sent,Rows_examined,ts --create-review-table
Ïà¹ØÎĵµ£º
INET_ATON(expr)
¸ø³öÒ»¸ö×÷Ϊ×Ö·û´®µÄÍøÂçµØÖ·µÄµãµØÖ·±íʾ£¬·µ»ØÒ»¸ö´ú±í¸ÃµØÖ·ÊýÖµµÄÕûÊý¡£µØÖ·¿ÉÒÔÊÇ4»ò8±ÈÌصØÖ·¡£
mysql> SELECT INET_ATON('209.207.224.40');
+-----------------------------+
| INET_ATON('209.207.224.40') |
+-----------------------------+
| 3520061480 |
+-------------------- ......
1.¼ÓÔØmysqlÇý¶¯°üProperties->java Build Path->Libraries->Add External JARs...
2.Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/Êý¾Ý¿âÃû?user=root&password=ÃÜÂë"); ......
¡¡MySQLµÄ×Ô´øÒýÇæ¿Ï¶¨Êǹ»ÓÃÁË£¬µ«ÊÇÔÚÓÐЩÇé¿öÏ£¬ÆäËûµÄÒýÇæ¿ÉÄÜÒª±ÈÊÖÍ·ËùÓøüÊʺÏÍê³ÉÈÎÎñ¡£Èç¹ûÔ¸ÒâµÄ»°£¬ÄãÉõÖÁ¿ÉÒÔʹÓÃMySQL++ APIÀ´´´½¨×Ô¼ºµÄÊý¾Ý¿âÒýÇ棬¾ÍÏñ´ò´©Æø¸××°ÉÏ×Ô¼ºµÄ»¯ÓÍÆ÷¡£ÏÖÔÚÈÃÎÒÃÇÀ´¿´¿´Äã¸ÃÈçºÎÑ¡ÔñÒýÇ棬ÒÔ¼°ÈçºÎÔÚ¿ÉÓÃÒýÇæÖ®¼äÇл»¡£
¡¡¡¡
¡¡¡¡Ñ¡ÔñÄãµÄÒýÇæ
¡¡¡¡
¡¡¡¡ÄãÄÜÓõÄÊý¾Ý¿ ......
×¼±¸
ls /usr/local/src // ÏÔʾÎļþÁбí
ls | wc -l // ²é¿´µ±Ç°ÎļþĿ¼ÏÂÎļþµÄ¸öÊý
gcc -v // ²é¿´±àÒ빤¾ßÊÇ·ñ´æÔÚ
rpm -qa|grep -i xxxx // ²é¿´ÏµÍ³ÖÐÊÇ·ñÒѾ°²×°ÁËijÈí¼þµÄÏà¹ØÈí¼þ°ü
rpm -e --nodeps xxxx // жÔØÈí ......
½â¾ö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ÅäÖÃÎļþ½ûµôÁËÕâ¸öÑ¡ ......