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 = '表名';