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
Concat (Round (sum (data_length/1024/1024), 2), ' MB ') as data from tables where table_schema= ' home ' and table_name= ' members ‘;
Add:
Actually looking at the size of a table alone, there is no need to use SQL statements, using the MySQL command: Show table status like ' table_name ' \g.
This is faster and more convenient. However, it is necessary to check the size of a particular database with an SQL statement.
This article is from the "it--Brother" blog, please make sure to keep this source http://402753795.blog.51cto.com/10788998/1760432
Quickly view library, table size in database