MySQL中查詢所有資料庫占用磁碟空間大小

2022-03-22 18:40:58 字數 687 閱讀 2466

查詢所有資料庫占用磁碟空間大小的sql語句:

複製** **如下:

select table_schema, concat(truncate(sum(data_length)/1024/1024,2),' mb') as data_size,

concat(truncate(sum(index_length)/1024/1024,2),'mb') as index_size

from information_schema.tables

group by table_schema

order by data_length desc;

查詢單個庫中所有表磁碟占用大小的sql語句:

複製** **如下:

select table_name, concat(truncate(data_length/1024/1024,2),' mb') as data_size,

concat(truncate(index_length/1024/1024,2),' mb') as index_size

from information_schema.tables where table_schema = 'testdb'

group by table_name

order by data_length desc;

以上語句測試有效,注意替換以上的testdb為資料庫名

操作MySQL資料庫查詢所有資料

coding utf 8 time 2020 8 7 22 01 author bingl email 15736980819 163.com file 操作mysql資料庫查詢所有資料.py software pycharm desc 靜,是一種修養。匯入pymysql import pymysq...

查詢 MySQL 例項上所有資料庫

除錯環境 centos 7.6 安裝版本 mysql community server 5.6.43 除錯人員 成長的小豬 jason song 通過以下方法我們可以查詢到當前例項中所有的資料庫列表 第一種通過 show 命令查詢 方式一 show databases 第二種通過 show 命令查詢...

SQL Server 查詢資料庫中所有資料庫名錶名

1.查詢資料庫中的所有資料庫名 select name from master sysdatabases order by name 2.查詢某個資料庫中所有的表名 select name from sysobjects where xtype u order by name xtype u 表示所...