潸死蝔撘瑁敺, 嗡葉銝閬瑼X亦唳寞航摨怒MySQL 臭誑撠瑁 SQL 隤亙券函銝靘, 臭誑芣臬瑁Y SQL 隤亦銝靘, 璅撠 MySQL 隤亦 Debug 撠梯擛敺憭鈭( T# j! N5 G3 ^- W! M
7 K. l3 _/ B( z' I% B1 r閬蝝瑁Y SQL 隤, 臭誑靽格 my.cnf 摰, my.cnf 憭詨其誑銝雿蝵:2 m j3 ?; x$ y* V$ w
2 y5 @) p$ g, D4 J
/etc/my.cnf
- n. X& l" v3 Z a/ q7 ]* P5 H/etc/mysql/my.cnf
/ j: ~' [0 Y( `. p
* g5 e9 ]- Y3 i my.cnf, [mysqld] 畾菔賢乩誑銝撟曇:8 `6 `5 v4 k% P3 @+ b; V
slow_query_log = 1
3 A9 g4 u; k& z/ W0 {5 Z$ oslow_query_log_file = /var/log/mysql-slow.log
! ^- A% B0 C0 L5 G/ N. k1 @long_query_time = 2
! f/ Q% T9 `. w" o隞乩撟曇交:
7 W! ^, N! {- {1 B* G
2 R$ y! C& F# a. l5 \5 l( k) kslow_query_log = 1
, c1 o2 I7 @/ Q0 H蝝瑁Y SQL 隤:# Y2 U, K" D; u6 q" J9 d; E1 P
7 p w! j3 ?7 E" g+ U3 S; g
slow_query_log_file = /var/log/mysql-slow.log
, M, f" r2 U- ]" i閮剖蝝瑼雿蝵桀 /var/log/mysql-slow.log. Q( I5 d. d) X
" X* v' i1 D( F+ j- {long_query_time = 2
7 f1 Y/ f y u% ]3 s9 o, z1 N閮剖 SQL 隤亙瑁頞 2 蝘, 靘踵撠 SQL 隤亙脣
! m9 U6 W# \, ?- \ h2 v5 P+ I/ L. l- y! b& @$ e$ X
靽格孵末 my.cnf 敺, 啣 MySQL 靘踹鈭
" i/ b0 R3 o3 n' l( d
, y& D9 R$ k) m! i4 S( z8 U% @5 H: G" C# S
|
|