The easiest method is to query the INFORMATION_SCHEMA. For Example:
SELECT ENGINE, COUNT(*), SUM(DATA_LENGTH), SUM(INDEX_LENGTH) FROM information_schema.TABLES WHERE TABLE_SCHEMA='menagerie' GROUP BY ENGINE;
Additionally here is a potentially faster example to estimate the db size (InnoDB only and if you do not use compressed tables) since it doesn’t use INFORMATION_SCHEMA.TABLES :
select sum( CLUST_INDEX_SIZE + OTHER_INDEX_SIZE)* @@innodb_page_size / 1024 / 1024 "Estimated size in Mb" from information_schema.INNODB_SYS_TABLESTATS where name like 'test/%'; +----------------------+ | Estimated size in Mb | +----------------------+ | 541.92187500 | +----------------------+ 1 row in set (0.00 sec)