蝔撘 Debug 敺敺Y洵銝銵餈質絲靘敺颲(蝔撘蝣澆云憭 compile ), 虫蝔桀瘜撠望臬敺W餈, 甇敺撖怠亦 DB, 撠勗 DB 憪敺, 隞亙停航蝔撘臬瑁芯 SQL 隤瘜.(隞乩芯誑 MySQL 箔蜓) 銋券餈質馱瘜舐 tcpdump wireshark 3306 port,憭芾 MySQL 撟曄車寞臭誑, 撠隞交甇∠嗡葉銝蝔, /etc/my.cnf(CentOS), restart mysql 喳: 蝚砌蝔: Slow query SQL 隤瘜: - log_slow_queries = /var/log/mysql/mysql-slow.log
- long_query_time = 2 (頞 2蝘 SQL 隤瘜閮韏瑚, 閮剔凋暺靘閮日臭臭蝔格寞 XD)7 F' w; e0 C ^# o6 u# N7 K( V
蝚砌蝔: 閮 MySQL Replication binlog: - log_bin = /var/log/mysql/mysql-bin.log (甇斗閬 mysqlbinlog 閫靘)
- mysql 撠 INSERT/UPDATE/DELETE 隤瘜閮潭迨(雿航瘜航質雿喟銝), 航撖怎策 SLAVE 函 log 瑼
) q# K, p$ z* K" W$ M
蝚砌蝔: 刻行迨寞, 撠 MySQL 瑁瘥銵隞文券質韏瑚: - log = /var/log/mysql/mysql.log
u5 e, o0 y8 `( z: j/ ]2 g
restart mysql 敺, tail -f /var/log/mysql/mysql.log 撠勗臭誑啣!
5 Z; m( u7 b* M% u. y+ @/ A" J |