潸死蝔撘瑁敺, 嗡葉銝閬瑼X亦唳寞航摨怒MySQL 臭誑撠瑁 SQL 隤亙券函銝靘, 臭誑芣臬瑁Y SQL 隤亦銝靘, 璅撠 MySQL 隤亦 Debug 撠梯擛敺憭鈭. |4 l) u, y: t, `+ Z3 s1 O/ l9 ~
4 u' g' e3 @/ X3 H( _* [閬蝝瑁Y SQL 隤, 臭誑靽格 my.cnf 摰, my.cnf 憭詨其誑銝雿蝵:
, T2 v. X& K& B( M6 h8 [+ Q3 r
4 [* a8 V8 C1 j2 y/etc/my.cnf
' H9 o/ Y/ u% P/etc/mysql/my.cnf, n( e; x& ~7 X- ?$ A9 H x
( f# c( A: R. |$ Z my.cnf, [mysqld] 畾菔賢乩誑銝撟曇:, ?1 Q i6 Q/ h. ?8 S! M2 |" ^+ I; Q* k7 G1 C
slow_query_log = 16 |! [: Q! A* t9 T5 V
slow_query_log_file = /var/log/mysql-slow.log
, l8 {! n3 c; L- n* xlong_query_time = 2 & r- s. w2 Z. |
隞乩撟曇交:
; X9 Q( p: T' p( R4 A3 _/ O
9 a$ d: b( U! @# ?& J: wslow_query_log = 1
0 a5 n& G; Z" k3 R蝝瑁Y SQL 隤:) G5 _' ~" E2 ? r3 ~4 ]9 _
$ D$ k- M1 ]; `4 W
slow_query_log_file = /var/log/mysql-slow.log
; w( G/ ?) K2 W0 `# B閮剖蝝瑼雿蝵桀 /var/log/mysql-slow.log
& c% P0 `6 j- }! O# u v3 w/ \2 N0 P! E
long_query_time = 2
! O% k/ x$ k5 y+ {8 w# ^1 _閮剖 SQL 隤亙瑁頞 2 蝘, 靘踵撠 SQL 隤亙脣- T K+ ~, h( O7 }5 M" A( u, l0 [5 V
( J+ g6 ~$ }$ v6 s" y4 q& a靽格孵末 my.cnf 敺, 啣 MySQL 靘踹鈭! q, s# ~5 Y1 a4 M" I
7 U- e9 H0 b/ @- |+ z0 y
6 ]0 v( ^ x/ T0 n4 e" B( ]
|
|