Mysql queries the occupied capacity of the database storage data

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

  1. Query the capacity of the specified database, and the returned unit is byte
        select sum(DATA_LENGTH)
        from information_schema.TABLES
        where table_schema = '你的数据库'
  1. 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 = '你的数据表';

Guess you like

Origin blog.csdn.net/qq_42900469/article/details/131041606