Mysql数据库占用空间查询

satuo20 1年前 ⋅ 569 阅读
  • 切换到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';

全部评论: 0

    我有话说: