您好,欢迎来到瑞福养生网。
搜索
您的当前位置:首页mysql如何查询数据库的大小

mysql如何查询数据库的大小

来源:瑞福养生网


相关学习推荐:mysql数据库

mysql查询数据库的大小的方法:

1、查询整个mysql数据库,整个库的大小;单位转换为MB。

select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from information_schema.TABLES

2、查询mysql数据库,某个库的大小;

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

3、查看库中某个表的大小;

select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data 
 from information_schema.TABLES
 where table_schema = 'testdb'
 and table_name = 'test_a';

4、查看mysql库中,test开头的表,所有存储大小;

select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data 
 from information_schema.TABLES
 where table_schema = 'testdb'
 and table_name like 'test%';

Copyright © 2019- rfth.cn 版权所有

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务