#1、查看表容量空间
SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_ROWS,ROUND(DATA_LENGTH/1024/1024/1024) AS 'data_size(G)',ROUND(INDEX_LENGTH/1024/1024/1024) AS 'index_size(G)',ROUND(DATA_FREE/1024/1024/1024) AS 'free_size(G)' FROM information_schema.tables WHERE TABLE_SCHEMA='test' AND TABLE_NAME IN ('sbtest1');
#2、查看用户连接
select user,count(1) as num from information_schema.processlist group by user;
#3、批量kill用户连接
select concat('kill ',id,';') from information_schema.processlist where user like '%user%' into outfile '/tmp/killpid.sql'; source /tmp/killpid.sql