Programming learning: use SQL commands to view the size of the MySQL database

To know the size of each database, the steps are as follows:

1. Enter the information_schema database (stored the information of other databases)

use information_schema;

2. Query the size of all data:

select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables;

3. View the size of the specified database:

For example, view the size of the database home

select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='home';

4. View the size of a table in the specified database

For example, view the size of the members table in the database home

select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='home' and table_name='members';

In addition, if you want to better improve your programming ability, learn C language and C++ programming! Overtaking in a curve, one step faster! I may be able to help you here~

UP has uploaded some video tutorials on learning C/C++ programming on the homepage. Those who are interested or are learning must go and take a look! It will be helpful to you~

Sharing (source code, actual project video, project notes, basic introductory tutorial)

Welcome partners who change careers and learn programming, use more information to learn and grow faster than thinking about it yourself!

Programming learning:

Programming learning:

Guess you like

Origin blog.csdn.net/weixin_45713725/article/details/115027815