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='表名';     修改成自己的库名 表名

  • 相关阅读:
    linux中apt-get使用
    部署ceph
    cinder存储服务
    ceph简介
    Horizon Web管理界面
    neutron网络服务2
    neutron网络服务
    nova计算服务
    cinder存储服务
    keystone身份认证服务
  • 原文地址:https://www.cnblogs.com/fangyuandoit/p/13713816.html
Copyright © 2011-2022 走看看