Mysql queries the occupied capacity of the database storage data
But using the information_schema database of mysql, the database metadata related information is stored
- Query the capacity of the specified database, and the returned unit is byte
select sum(DATA_LENGTH)
from information_schema.TABLES
where table_schema = '你的数据库'
- Query the size of the specified data table, the returned unit is byte
select sum(DATA_LENGTH)
from information_schema.TABLES
where table_schema = '你的数据库'
and table_name = '你的数据表';