1、指定schema 数据库
use information_schema
2、查询所有数据的大小
select concat(round(sum(DATA_LENGTH/1024/1024),2),‘MB‘) as data from TABLES;
3、查看指定数据库的大小(如school)
select concat(round(sum(DATA_LENGTH/1024/1024),2),‘MB‘) as data from TABLES where table_schema=‘school‘;
4、查看指定数据库的表的大小(如数据库school中的user表)
select concat(round(sum(DATA_LENGTH/1024/1024),2),‘MB‘) as data from TABLES where table_schema=‘school‘ and table_name=‘user‘;
时间: 2024-10-22 06:38:25