View the storage space occupied by the data table in mysql

View the storage space occupied by each table in the database in mysql

use information_schema;

select table_name,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='dbname' 
group by table_name;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324987288&siteId=291194637