潸死蝔撘瑁敺, 嗡葉銝閬瑼X亦唳寞航摨怒MySQL 臭誑撠瑁 SQL 隤亙券函銝靘, 臭誑芣臬瑁Y SQL 隤亦銝靘, 璅撠 MySQL 隤亦 Debug 撠梯擛敺憭鈭
% }2 f \% R% [) x5 @7 _) G3 e4 t/ S1 X2 E3 i& [7 \5 X7 i7 k: J+ [
閬蝝瑁Y SQL 隤, 臭誑靽格 my.cnf 摰, my.cnf 憭詨其誑銝雿蝵:* L$ O* v- y4 e9 Z2 r4 }9 n4 a+ p
# P% h( w: N2 M/etc/my.cnf
! p! p% r5 D! n, B8 q( S5 F" ^/etc/mysql/my.cnf
, O# {; ?+ ]9 h7 k; W4 X( T% t& T; T$ q, @4 F% p7 r
my.cnf, [mysqld] 畾菔賢乩誑銝撟曇:
: K/ |7 P4 |- H2 \8 Q$ j8 `slow_query_log = 1
1 R% {' c# d& I' Y+ eslow_query_log_file = /var/log/mysql-slow.log
/ h* A, H& b- m! K) Y* {( p4 xlong_query_time = 2 9 w0 W2 x" g1 Y6 A$ R4 r) I8 K
隞乩撟曇交:, \- S8 J P& a
( v. [9 Q/ ?* x( Z7 Lslow_query_log = 11 Y- X. h1 H/ i" j; e
蝝瑁Y SQL 隤:
; {/ n+ N8 \, U+ e( A
. O5 l' {6 N1 z1 R" o4 [1 Kslow_query_log_file = /var/log/mysql-slow.log! U* T7 I, T- A B$ j' P: q
閮剖蝝瑼雿蝵桀 /var/log/mysql-slow.log9 e! y: D' k5 ~- q& S' |
' {$ r1 u3 E% G3 u& Flong_query_time = 20 ~8 X5 f( ^/ }. J
閮剖 SQL 隤亙瑁頞 2 蝘, 靘踵撠 SQL 隤亙脣3 s; k' g. L0 m4 U
: ^3 @6 q" V% [1 L0 {
靽格孵末 my.cnf 敺, 啣 MySQL 靘踹鈭+ g. O9 W) s6 D& v7 `' e/ N
* _: d4 P0 F- j8 F) S6 I) R! Z2 o5 a
|
|