潸死蝔撘瑁敺, 嗡葉銝閬瑼X亦唳寞航摨怒MySQL 臭誑撠瑁 SQL 隤亙券函銝靘, 臭誑芣臬瑁Y SQL 隤亦銝靘, 璅撠 MySQL 隤亦 Debug 撠梯擛敺憭鈭
% q' p3 s& K& c5 u8 e I% [# x
$ j6 A- t+ s+ t u7 m6 V閬蝝瑁Y SQL 隤, 臭誑靽格 my.cnf 摰, my.cnf 憭詨其誑銝雿蝵:' u) @9 a' M' P$ I. Y
" d# z) `8 j9 o' v( l, n/etc/my.cnf
' I. N( f l- V( c) W5 u# X/etc/mysql/my.cnf
8 U: E" V m- G" |" j N, G& f+ Z. }0 a! g
my.cnf, [mysqld] 畾菔賢乩誑銝撟曇:
! F7 P W ]5 J( {9 C, L7 ]slow_query_log = 1
/ ]5 o: }+ G) V' b; {& y; U+ W' R- tslow_query_log_file = /var/log/mysql-slow.log
& \/ l3 _: d+ nlong_query_time = 2
4 _( I6 V D" M& [3 U C隞乩撟曇交:9 Q' l6 ?1 O7 T( z, `: ?( `
6 @6 e/ |! C% H. T% a+ x, ]
slow_query_log = 1
, g! [% E# r. p' r) e+ t蝝瑁Y SQL 隤:/ m& Q/ ]' I; g C
5 s8 P l" |; Z% ]slow_query_log_file = /var/log/mysql-slow.log
3 x* I1 C, h# Q; {/ a0 z+ T7 D閮剖蝝瑼雿蝵桀 /var/log/mysql-slow.log7 ?; d/ U# \" N( d1 t5 |
. Q6 a7 Y& [+ p8 F1 nlong_query_time = 2! i! u- T, v1 J; C7 |# A7 x% o6 ]
閮剖 SQL 隤亙瑁頞 2 蝘, 靘踵撠 SQL 隤亙脣
4 z" g @/ d/ W2 [- ]
5 B1 W5 }* i$ ~ W$ n靽格孵末 my.cnf 敺, 啣 MySQL 靘踹鈭
, P4 r. q3 K" x# y7 g/ U9 y' s1 d8 r- T ?+ ~! J
" @6 s8 ~- G2 i7 X |
|