Skip to content

Instantly share code, notes, and snippets.

@fhdalikhan
Created April 29, 2019 07:10
Show Gist options
  • Save fhdalikhan/2eba73a41913c421053f2ab82c5cdc8b to your computer and use it in GitHub Desktop.
Save fhdalikhan/2eba73a41913c421053f2ab82c5cdc8b to your computer and use it in GitHub Desktop.
SQL to count all databases and tables in mysql
# COUNT ALL DATABASES
SELECT COUNT(*) FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mysql','information_schema');
# COUNT ALL TABLES
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment