Home  >  Article  >  Database  >  解析mysql中如何获得数据库的大小_MySQL

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

WBOY
WBOYOriginal
2016-06-01 13:24:59824browse

bitsCN.com

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数据库是否已经长期不再使用。

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn