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:
For example, check the size of the database Hellodb
SELECT concat (Round (sum (data_length/1024/1024), 2), ' MB ') as DATA from TABLES WHERE table_schema= ' Hellodb ';
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), 2), ' KB ') as DATA from TABLES WHERE table_schema= ' hellodb ' and Table_name= ' Students ';
Note: Because the students table in Hellodb is less than 1MB, use the KB display instead
This article is from the "Sea Width Sky" blog, please be sure to keep this source http://il23f.blog.51cto.com/8620950/1437732