myMySQL数据库查询数据库的大小 MySQL数据库使用教程

凤凰 2021-1-19 87 1/19

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

myMySQL数据库查询数据库的大小 MySQL数据库使用教程

相关学习推荐:mysql数据库

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

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

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

myMySQL数据库查询数据库的大小 MySQL数据库使用教程

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

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

myMySQL数据库查询数据库的大小 MySQL数据库使用教程

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

myMySQL数据库查询数据库的大小 MySQL数据库使用教程

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

myMySQL数据库查询数据库的大小 MySQL数据库使用教程

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

- THE END -

凤凰

1月19日09:27

最后修改:2021年1月19日
0

非特殊说明,本博所有文章均为博主原创。