Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Mysql view the database size

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces Mysql how to view the database size, the content is very detailed, interested friends can refer to reference, I hope to help you.

1 Command line access to database

[root@80 ~]# mysql -uroot -pEnter password:

2 View database

mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || test |+--------------------+

3 View "TABLES" for information_schema

mysql> use information_schema;| TABLES |

4 View field structure

mysql> desc tables;+-----------------+---------------------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-----------------+---------------------+------+-----+---------+-------+| TABLE_CATALOG | varchar(512) | NO | | | || TABLE_SCHEMA | varchar(64) | NO | | | || TABLE_NAME | varchar(64) | NO | | | || TABLE_TYPE | varchar(64) | NO | | | || ENGINE | varchar(64) | YES | | NULL | || VERSION | bigint(21) unsigned | YES | | NULL | || ROW_FORMAT | varchar(10) | YES | | NULL | || TABLE_ROWS | bigint(21) unsigned | YES | | NULL | || AVG_ROW_LENGTH | bigint(21) unsigned | YES | | NULL | || DATA_LENGTH | bigint(21) unsigned | YES | | NULL | || MAX_DATA_LENGTH | bigint(21) unsigned | YES | | NULL | || INDEX_LENGTH | bigint(21) unsigned | YES | | NULL | || DATA_FREE | bigint(21) unsigned | YES | | NULL | || AUTO_INCREMENT | bigint(21) unsigned | YES | | NULL | || CREATE_TIME | datetime | YES | | NULL | || UPDATE_TIME | datetime | YES | | NULL | || CHECK_TIME | datetime | YES | | NULL | || TABLE_COLLATION | varchar(32) | YES | | NULL | || CHECKSUM | bigint(21) unsigned | YES | | NULL | || CREATE_OPTIONS | varchar(255) | YES | | NULL | || TABLE_COMMENT | varchar(2048) | NO | | | |+-----------------+---------------------+------+-----+---------+-------+

5 View DB data size

mysql> select table_schema,round(sum(DATA_LENGTH)/1024/1024,2) as table_size from tables group by table_schema;+--------------------+------------+| table_schema | table_size |+--------------------+------------+| bomo_backend | 0.09 || test1 | 234.16 || test2 | 0.17 || information_schema | 0.00 || mysql | 0.71 || performance_schema | 0.00 || test | 0.03 |+--------------------+------------+

6 View table data size

mysql> select table_schema,table_name,concat(round(data_length/1024/1024,2),'M') as table_size from tables where table_schema = 'grab';+--------------+--------------+------------+| table_schema | table_name | table_size |+--------------+--------------+------------+| grab | product | 215.12M || grab | result | 13.52M || grab | rule | 0.02M || grab | task | 5.52M |+-------------- If you think the article is good, you can share it so that more people can see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report