use information_schema;
#查询某一个数据库总的数据大小
#方法1
SELECT data_length,index_length from tables where table_schema="infrastructure";
#方法2
select concat(round(sum(data_length/1024/1024),2),'MB') as data_length_MB, concat(round(sum(index_length/1024/1024),2),'MB') as index_length_MB from tables where table_schema='infrastructure';
#查询某数据库中某一表的大小
#方法1
SELECT data_length,index_length from tables where table_schema="infrastructure" and table_name = "user";
#方法2
select concat(round(sum(data_length/1024/1024),2),'MB') as data_length_MB, concat(round(sum(index_length/1024/1024),2),'MB') as index_length_MB from tables where table_schema='infrastructure' and table_name = "user";
use infrastructure;
#查看infrastructure数据库各个表的详细信息,其中包含表的大小信息;
show TABLE STATUS;
#查询某一个数据库总的数据大小
#方法1
SELECT data_length,index_length from tables where table_schema="infrastructure";
#方法2
select concat(round(sum(data_length/1024/1024),2),'MB') as data_length_MB, concat(round(sum(index_length/1024/1024),2),'MB') as index_length_MB from tables where table_schema='infrastructure';
#查询某数据库中某一表的大小
#方法1
SELECT data_length,index_length from tables where table_schema="infrastructure" and table_name = "user";
#方法2
select concat(round(sum(data_length/1024/1024),2),'MB') as data_length_MB, concat(round(sum(index_length/1024/1024),2),'MB') as index_length_MB from tables where table_schema='infrastructure' and table_name = "user";
use infrastructure;
#查看infrastructure数据库各个表的详细信息,其中包含表的大小信息;
show TABLE STATUS;