How to Get True Size of MySQL Database?

前端 未结 10 790
南笙
南笙 2020-12-02 04:35

I would like to know how much space does my MySQL database use, in order to select a web host. I found the command SHOW TABLE STATUS LIKE \'table_name\' so when

相关标签:
10条回答
  • 2020-12-02 04:39

    If you are using MySql Workbench, its very easy to get all details of Database size, each table size, index size etc.

    1. Right Click on Schema
    2. Select Schema Inspector option

    3. It Shows all details of Schema size

    4. Select Tables Tab to see size of each table.

    5. Table size diplayed in Data Lenght column

    0 讨论(0)
  • 2020-12-02 04:45

    SUM(Data_free) may or may not be valid. It depends on the history of innodb_file_per_table. More discussion is found here.

    0 讨论(0)
  • 2020-12-02 04:51

    You can get the size of your Mysql database by running the following command in Mysql client

    SELECT  sum(round(((data_length + index_length) / 1024 / 1024 / 1024), 2))  as "Size in GB"
    FROM information_schema.TABLES
    WHERE table_schema = "<database_name>"
    
    0 讨论(0)
  • 2020-12-02 04:53

    if you want to find it in MB do this

    SELECT table_schema                                        "DB Name", 
       Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" 
    FROM   information_schema.tables 
    GROUP  BY table_schema; 
    
    0 讨论(0)
提交回复
热议问题