To know the size of each database, proceed as follows:
1. Access to the INFORMATION_SCHEMA database (information on other databases)
Use INFORMATION_SCHEMA;
2, query the size of all data:
Select Concat (Round (sum (data_length/1024/1024), 2), ' MB ') as data from tables;
3. View the size of the specified database:
Like looking at the size of the database home
Select Concat (Round (sum (data_length/1024/1024), 2), ' MB ') as data from tables where table_schema= ' home ';
4. View the size of a table in a specified database
For example, view the size of the members table in the database home
Select Concat (Round (sum (data_length/1024/1024), 2), ' MB ') as data from tables where table_schema= ' home ' and Table_name= ' Members ';
5. View the size of all tables
Select table_name,data_length/1024/1024/1024 as LENGB from tables where table_schema= ' database name ' ORDER by LENGB DESC;
View MySQL database size with SQL commands