Mysql>MySQL> UseInformation_schema;/*switch to INFORMATION_SCHEMA data*/ Databasechanged MySQL>MySQL> SelectConcatround(sum(Data_length/1024x768/1024x768),2),'MB') asData fromTables/*querying all data sizes*/ +----------+ |Data| +----------+ | 123.68MB| +----------+ 1Rowinch Set(0.36sec) MySQL> SelectConcatround(sum(Data_length/1024x768/1024x768),2),'MB') asData fromTableswhereTable_schema='Hrkip';/*querying data size with database name "Hrkip"*/ +--------+ |Data| +--------+ | 8.65MB| +--------+ 1Rowinch Set(0.00sec) MySQL> SelectConcatround(sum(Data_length/1024x768/1024x768),2),'MB') asData fromTableswhereTable_schema='Hrkip' andtable_name='JX_LSJL';/*Query database name "Hrkip", data size with table named "Jx_lsjl "*/ +--------+ |Data| +--------+ | 6.77MB| +--------+ 1Rowinch Set(0.00sec)
Note:
Data_length: Storing Data size
data_length/1024/1024: Convert bytes to MB
Round (sum (data_length/1024/1024), 2): Take Two decimal places
Concat (Round (sum (data_length/1024/1024), 2), ' MB '): Append unit "MB" to the result of the calculation
View MySQL database size using SQL commands