Cheat Sheet - MySQL

Count all tables in a database

-- Count number of tables 
select count(*)
from information_schema.tables
where table_schema = '<my-schema>'

-- Warning! Might return inaccurate results!
select TABLE_NAME, TABLE_ROWS
from information_schema.tables
where table_schema = '<my-schema>'

-- Count all rows in all tables 
SELECT SUM(TABLE_ROWS) 
     FROM INFORMATION_SCHEMA.TABLES 
     WHERE TABLE_SCHEMA = '<my-schema>';