潸死蝔撘瑁敺, 嗡葉銝閬瑼X亦唳寞航摨怒MySQL 臭誑撠瑁 SQL 隤亙券函銝靘, 臭誑芣臬瑁Y SQL 隤亦銝靘, 璅撠 MySQL 隤亦 Debug 撠梯擛敺憭鈭! Y8 T3 G! V/ O) A- J
* \; W0 `1 ]7 A$ F( n, }& q) }
閬蝝瑁Y SQL 隤, 臭誑靽格 my.cnf 摰, my.cnf 憭詨其誑銝雿蝵:
4 G6 \# h! X3 }( e3 F4 G" G( ?8 |+ M+ R6 s w
/etc/my.cnf
! b( K6 T% u- J) p0 r8 e/etc/mysql/my.cnf0 M* _! O) T# _6 E6 o
. s( D: Q3 h0 i0 R4 M my.cnf, [mysqld] 畾菔賢乩誑銝撟曇:: H0 Q% \) t- F3 a5 C% j; b" {
slow_query_log = 1
+ k+ H% F5 J' X1 l wslow_query_log_file = /var/log/mysql-slow.log
; `; z- I- l0 K% V" k( ^long_query_time = 2 8 L+ R4 I9 I9 E
隞乩撟曇交:( C, I4 S$ L: {* I4 E! i0 E
, O$ e9 l& A% K# G$ m8 nslow_query_log = 18 B# m7 \% }0 X# H# F) h
蝝瑁Y SQL 隤:$ L. o! V ^! _9 D5 ^
9 M% ?1 B, t! Y# i/ a/ @2 I- r
slow_query_log_file = /var/log/mysql-slow.log8 ~# M# z$ j8 Q ]% z* E$ K
閮剖蝝瑼雿蝵桀 /var/log/mysql-slow.log
. ?* g- m: H! n# ^2 ~( {# T
0 [! q* O. R! ~long_query_time = 2. W! c/ w! x' n
閮剖 SQL 隤亙瑁頞 2 蝘, 靘踵撠 SQL 隤亙脣, V( |0 x. n6 [3 N
; b5 v4 n }- L5 w靽格孵末 my.cnf 敺, 啣 MySQL 靘踹鈭1 o) V& g% V& U) x+ e
$ w5 {( W4 \; ^5 u8 d1 ^2 S
6 P+ R- ^5 G/ f3 r
|
|