潸死蝔撘瑁敺, 嗡葉銝閬瑼X亦唳寞航摨怒MySQL 臭誑撠瑁 SQL 隤亙券函銝靘, 臭誑芣臬瑁Y SQL 隤亦銝靘, 璅撠 MySQL 隤亦 Debug 撠梯擛敺憭鈭+ s% u% F) v1 B( Y; h
. X+ d% J" W. z3 B! T7 z( C閬蝝瑁Y SQL 隤, 臭誑靽格 my.cnf 摰, my.cnf 憭詨其誑銝雿蝵:
0 y6 d) D& I, o- E
+ I, O2 j0 b% k$ |$ w* H* H! V/etc/my.cnf4 L/ k* e- D( A7 e& `
/etc/mysql/my.cnf# u% \# l" x( |; k" Q
* B6 c3 _; A5 `) p* N/ U9 ~8 r my.cnf, [mysqld] 畾菔賢乩誑銝撟曇:* j. y. T6 w( [: p, a# e3 q
slow_query_log = 1
% n6 Q7 b) v7 ~" B2 ?: C5 O: Y' Islow_query_log_file = /var/log/mysql-slow.log; g4 A' n2 j K- y9 J
long_query_time = 2
& y4 C5 P5 N! H) P, H隞乩撟曇交:$ _$ d# M6 d/ f# s8 N) P; c8 M
6 o& E0 }3 A9 P7 A- r# Oslow_query_log = 1% I9 I& T( x" Y) s
蝝瑁Y SQL 隤:
9 M& k' f: |: ?$ s7 n* R
& K0 S, X# K! X) F- w2 c9 E# [slow_query_log_file = /var/log/mysql-slow.log" u3 v; l E! Y- F
閮剖蝝瑼雿蝵桀 /var/log/mysql-slow.log
; ~! K; ]% K! W7 t; `* L% _& M; a5 G( ^
long_query_time = 21 Z: r0 ^" X* m# s
閮剖 SQL 隤亙瑁頞 2 蝘, 靘踵撠 SQL 隤亙脣
1 N1 G/ o, A" @8 [
! i* X2 C* T8 u# t7 H# v靽格孵末 my.cnf 敺, 啣 MySQL 靘踹鈭
4 Q _6 a2 \0 n$ A1 \7 q* P
2 D& ^4 y* j. `0 d, p( A' v
4 C6 d- N7 f6 q4 @- f7 f. [ |
|