1.查看数据库表基本信息。
select * from information_schema.TABLES
where information_schema.TABLES.TABLE_SCHEMA = '数据库名'
and information_schema.TABLES.TABLE_NAME = '表名';
2.查看MySQL数据库大小
SELECT sum(DATA_LENGTH)+sum(INDEX_LENGTH) FROM information_schema.TABLES
where TABLE_SCHEMA='数据库名';
得到的结果是以字节为单位,除1024为K,除1048576(=1024*1024)为M。
3.查看表的最后mysql修改时间
select TABLE_NAME,UPDATE_TIME from information_schema.TABLES
where TABLE_SCHEMA='数据库名' order by UPDATE_TIME desc limit 1;
select TABLE_NAME,UPDATE_TIME from information_schema.TABLES
where TABLE_SCHEMA='数据库名' and information_schema.TABLES.TABLE_NAME = '表名';