Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to display number of rows for every table in a given database with a single command?

share|improve this question
up vote 1 down vote accepted

Use the information_schema:

select table_schema database, table_name, table_rows rowcount
       from information_schema.tables 
where table_schema = 'DATABASE_TO_LOOK_UP'
and engine = 'MYISAM';

Afaik only for MyISAM-tables an exact rowcount is stored in the information_schema tables. If you use the SQL above for INNODB-tables, the rowcount displayed will be an approximation.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.