mysql查询数据库的大小

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卸载环境查看是否已安装MySQL卸载mysql服务查看是否...
目录数据类型数据类型分类数值类型以TINYINT认识整型族有符号...
目录表的约束空属性非空约束(NOT NULL Constraint)默认值定...
目录函数时间日期函数:字符串函数数学函数其他函数 函数 时间...
目录使用C语言连接库的安装C APImysql_initmysql_real_conne...
目录用户用户管理查询所有用户查看当前用户查看当前连接数创...