数据库(存放了其他的数据库的信息)
use
information_schema
2、查询所有数据的大小
select
concat(round(sum(DATA_LENGTH/1024/1024),2),'MB')
as
data
from
TABLES
3、查看指定数据库的大小
数据库apoyl
select
concat(round(sum(DATA_LENGTH/1024/1024),2),'MB')
as
data
from
TABLES
where
table_schema='apoyl'
4、查看指定数据库的表的大小
比如说
数据库apoyl
中apoyl_test表
select
concat(round(sum(DATA_LENGTH/1024/1024),2),'MB')
as
data
from
TABLES
where
table_schema='apoyl'
and
table_name='apoyl_test'
整完了,有兴趣的可以试哈哦!挺使用哈
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%'
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)