欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

解析mysql中如何获得数据库的大小

程序员文章站 2024-02-22 19:40:46
1.查看mysql数据库大小select sum(data_length)+sum(index_length)from information_schema.tables...

1.查看mysql数据库大小
select sum(data_length)+sum(index_length)
from information_schema.tables where table_schema='数据库名';
得到的结果是以字节为单位,除1024为k,除1048576(=1024*1024)为m。

2.查看表的最后mysql修改时间
select table_name,update_time from information_schema.tables where table_schema='数据库名';
可以通过查看数据库中表的mysql修改时间,来确定mysql数据库是否已经长期不再使用。