mysql查询数据库的大小

PHPz
PHPz 原创
2020-09-27 11:12:12 15478浏览

mysql查询数据库的大小的方法:1、查询整个库的大小,代码为【select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB')】;2、查询某个库的大小,代码为【from informati】。

相关学习推荐:mysql数据库

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

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

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

1600670274462162.png

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

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

1600670283899878.png

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';

1600670291393589.png

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%';

1600670296292883.png

以上就是mysql查询数据库的大小的详细内容,更多请关注php中文网其它相关文章!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。