- 切换到use information_schema
use information_schema;
- 所有数据库的大小
select concat(round(sum(data_length/1024/1024),2),'MB') as data_size from tables;
- 指定数据库的大小:
select concat(round(sum(data_length/1024/1024),2),'MB') as data_size from tables where table_schema='my_db1';
- 定数据库的某个表的大小
select concat(round(sum(data_length/1024/1024),2),'MB') as data_size from tables where table_schema='my_db1' and table_name='user_info';
网友评论