1、查询某数据库大小语句: SELECT CONCAT(ROUND(SUM(DATA_LENGTH/1024/1024),2),'MB') AS DATA FROM TABLES WHERE table_schema='yxl'; --table_schema等于数据库。
2、查询某数据库某表大小语句: SELECT CONCAT(ROUND(SUM(DATA_LENGTH/1024/1024),2),'MB') AS DATA,table_name FROM TABLES WHERE table_schema='yxl' AND table_name='pf_user_info'; --table_schema等于数据库。table_name等于表名。
3、查询所有库大小语句: SELECT CONCAT(ROUND(SUM(DATA_LENGTH/1024/1024),2),'MB') AS DATA FROM TABLES;
4、查看某一个库,所有表的大小情况: SELECT TABLE_NAME,TABLE_ROWS,DATA_LENGTH/1024/1024 "DATA_LENGTH",CREATE_TIME,TABLE_COLLATION FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'yxl' ORDER BY TABLE_ROWS DESC