潸死蝔撘瑁敺, 嗡葉銝閬瑼X亦唳寞航摨怒MySQL 臭誑撠瑁 SQL 隤亙券函銝靘, 臭誑芣臬瑁Y SQL 隤亦銝靘, 璅撠 MySQL 隤亦 Debug 撠梯擛敺憭鈭6 Z1 n5 t; e+ s0 N5 d0 x9 g
' ^' t% F1 c' G( W閬蝝瑁Y SQL 隤, 臭誑靽格 my.cnf 摰, my.cnf 憭詨其誑銝雿蝵:
, G# W. m" N I# Y% p6 s2 f- M
/ C+ n4 }/ Y& P5 U# S! s: j/etc/my.cnf
. T2 K" V) k) K. N& p+ b/etc/mysql/my.cnf D M, O1 }( {& C1 S$ P8 I
; C' F7 r# Z2 | F5 g
my.cnf, [mysqld] 畾菔賢乩誑銝撟曇:
5 Y! I$ [4 g! D& Tslow_query_log = 1
- _6 f* Z6 _' D( Vslow_query_log_file = /var/log/mysql-slow.log
, n Z4 H2 o% |8 M, X" \( blong_query_time = 2 2 [- \5 V( r+ X- c2 O3 T! }4 `, b
隞乩撟曇交:! {, c' M2 q. c: Q( Z5 K
+ q4 ?9 R+ w/ z3 Islow_query_log = 1
, Y1 B, I. T) s+ i: Q7 b& o蝝瑁Y SQL 隤:2 W0 J0 ~; c, _5 W
! d* G X' H6 Z: x" G
slow_query_log_file = /var/log/mysql-slow.log
) X9 c0 ?7 \& }4 h: P閮剖蝝瑼雿蝵桀 /var/log/mysql-slow.log
5 {) S: [0 @+ R+ x/ x7 i7 Q) A- X% d% ~( X% h, X
long_query_time = 2( c" e1 s$ H: ?$ \8 E+ ^
閮剖 SQL 隤亙瑁頞 2 蝘, 靘踵撠 SQL 隤亙脣
* f N( @! ?1 K6 I/ A+ ?: F% c# q
. s. |6 h: f! R/ B靽格孵末 my.cnf 敺, 啣 MySQL 靘踹鈭5 l1 `* s& \, ^! j' Z" K' ^, ?" @
$ c8 r! D9 z" A2 [6 ]
$ N' O' ?* i0 f5 Z5 E |
|