To count the total number of records on a MySQL database, we could run the following command:
SELECT SUM(TABLE_ROWS) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '{tablename}'; |
If we need to know the number of records per each table, we can run:
SELECT TABLE_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '{tablename}'; |
Source: Stack Overflow