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)
Select sum (DATA_LENGTH) + sum (INDEX_LENGTH) from information_schema.tables
Where table_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
Use information_schema;
Next, ignore the index size.
1.2 query the size of all data
Select concat (round (sum (DATA_LENGTH/1024/1024), 2), 'M') from tables;
This will take longer.
1.3 view the size of a table in the database
Select concat (round (sum (DATA_LENGTH/1024/1024), 2), 'M') from tables where table_schema = 'database name' AND table_name = 'table name ';
2. View Software
You can install PhpMyAdmin or
From the column oscar999