#查看所有连接
show processlist;
查看SQL执行计划
explain select * from table;
#查看数据库连接数
SELECT SUBSTRING_INDEX(HOST,':',1) AS ip , COUNT(*) FROM information_schema.processlist GROUP BY ip;
#查看某台应用连接数据库数
SELECT * FROM information_schema.processlist WHERE HOST LIKE '%192.168.1.122%' and TIME>90;
#查看慢SQL
SELECT * FROM mysql.`slow_log` t WHERE user_host LIKE '%192.168.1.122%' ORDER BY t.`query_time` DESC;