1. Command Line
Preface:
To know the space occupied by a table, it is equivalent to the data size + index size.
Show databases; (view the number of databases, also known as table schema; it is a bit of a string)
1.1 view the size occupied by a single database (or table schema)
[SQL]
- Select Sum(DATA_LENGTH) +Sum(INDEX_LENGTH)FromInformation_schema.tables
- WhereTable_schema ='Database name';
The result is in bytes. If it is converted into megabytes, it is divided by 1024*1024.
Note: The information_schema database contains a lot of statistics for the entire database. You can view them to obtain database-related information.
Easy to understand, go to information_schema to view
[SQL]
- Use information_schema;
Next, ignore the index size.
1.2 query the size of all data
[SQL]
- SelectConcat (round (Sum(DATA_LENGTH/1024/1024), 2 ),'M')FromTables;
This will take longer.
1.3 view the size of a table in the database
[SQL]
- SelectConcat (round (Sum(DATA_LENGTH/1024/1024), 2 ),'M')FromTablesWhereTable_schema = 'database name'ANDTable_name = 'table name ';
2. View Software
You can install PhpMyAdmin or