6. mysql日誌位置:mysql
慢查詢日誌分析工具sql
explain分析慢查詢:工具
desc table_name;日誌
show create table table_name;code
use information_schema; SELECT a.TABLE_SCHEMA AS '數據名' ,a.TABLE_NAME AS '表名' ,a.INDEX_NAME AS '索引1' ,b.INDEX_NAME AS '索引2' ,a.COLUMN_NAME AS '重複列名' FROM STATISTICS a JOIN STATISTICS b ON a.TABLE_SCHEMA = b.TABLE_SCHEMA AND a.TABLE_NAME = b.TABLE_NAME AND a.SEQ_IN_INDEX = b.SEQ_IN_INDEX AND a.COLUMN_NAME = b.COLUMN_NAME WHERE a.SEQ_IN_INDEX = 1 AND a.INDEX_NAME <> b.INDEX_NAME;
沒有安裝的先安裝orm
wget http://www.percona.com/downloads/percona-toolkit/2.2.4/percona-toolkit-2.2.4.tar.gz tar percona-toolkit-2.2.4.tar.gz cd percona-toolkit-2.2.4 perl Makefile.PL make && make install 若是報錯(Can't locate Time/HiRes.pm in @INC (@INC contains....)的話, yum -y install perl-Time-HiRes
查詢語句blog
pt-duplicate-key-checker -uroot -p123456 -h127.0.0.1 (若是報錯,請按照提示安裝依賴)