«

mysql查询数据库大小

时间:2024-2-20 11:36     作者:韩俊     分类: Mysql


mysql 查看数据库大小的方法。

mysql> show databases;
mysql> use information_schema;

查询所有数据库大小:

#仅查询数据大小
select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from TABLES;

#仅查询索引大小
select concat(round(sum(INDEX_LENGTH/1024/1024),2),'MB') as data from TABLES;

select concat(round(sum(DATA_LENGTH/1024/1024)+sum(INDEX_LENGTH/1024/1024),2),'MB') as data from TABLES;

查询指定的数据库大小(没含索引):

select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from TABLES where table_schema='phpernote';

查询数据库内指定表的大小(没含索引):

select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from TABLES where table_schema='phpernote' and table_name='article';

标签: mysql

热门推荐