1. 程式人生 > >用SQL語句檢視資料庫資料量的大小

用SQL語句檢視資料庫資料量的大小

1、進入MQSQL命令列介面

2、輸入密碼

3、輸入命令 

 

1、進入information_schema 資料庫(存放了其他的資料庫的資訊)

use information_schema;

 

2、查詢所有資料的大小:

select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables;

 

3、檢視指定資料庫的大小:

比如檢視資料庫databasesystem的大小

select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='databasesystem';

 

4、檢視指定資料庫的某個表的大小

比如檢視資料庫databasesystem中 user表的大小

select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='databasesystem' and table_name='user';

 參考自:https://blog.csdn.net/atec2000/article/details/7041352