zoukankan      html  css  js  c++  java
  • 查询mysql 库和表占的大小

    use information_schema;
    select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables;
    select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='库名';
    select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='库名' and table_name='表名';

    解释如下:

    在mysql中有一个默认的数据库 库名为`information_schema`,information_schema这张数据库保存了MySQL服务器所有数据库的信息。
     

    use information_schema;   调用mysql自己的库分析,这个不改

    1 查询整个库的情况

    select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables;        什么都不改  直接执行

    2 查询某个库的情况

    select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='库名';   修改成自己的库名

    3 查询某个库下某个表情况

    select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='库名' and table_name='表名';     修改成自己的库名 表名

  • 相关阅读:
    python高级 之(三) --- 高阶函数
    python高级 之(二) --- 类装饰器
    python高级 之(一) --- 函数类型
    jQuery
    css
    html
    px2rem
    keep-alive标签
    rem适配方案2(flexible.js)
    媒体查询
  • 原文地址:https://www.cnblogs.com/fangyuandoit/p/13713816.html
Copyright © 2011-2022 走看看