Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

How can I get a rowcount for all tables in MySQL. I can do this databases by database if that is easier.

The purpose is to do a cursory check on my database replication that was just setup.

share|improve this question

try mk-table-checksum instead. docs might be scary but together with mk-checksum-filter it's very useful tool.

share|improve this answer

If you are want to check on your replication setup, have you considered using:

share|improve this answer

./mysql -utest -ptest dbname -e 'show table status\G' | awk '/Name/ {name = $2}; /Rows/ {print $2"\t"name}' | sort -gr

share|improve this answer

I found this article to be a very crisp and clean way to retrieve all the tables along with their row counts.

share|improve this answer
This answer would be more useful if it went into more detail about the solution in the linked article. Links often go away; if this one does, this answer becomes useless. – pjmorse Dec 14 '12 at 2:04

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.