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

Basic operating Command Guide for Mysql (MariaDB)

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

MYSQL basic command operation

1. Login method:

Mysql-u root-p

two。 Show all databases:

Show databases

3. Manipulate the specified database (take information_schema as an example)

Use information_schema

4. Show all tables

Show tables

5. Show table structure (take users table as an example)

Discribe tables

6. Query the size of all databases:

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

7. Query the size of the specified database (take zabbix as an example):

Select concat (round (sum (data_length/1024/1024), 2), 'MB') as data from tables where table_schema='zabbix'

8. Query the size of all tables in the specified database (take zabbix as an example):

SELECT TABLE_NAME,DATA_LENGTH+INDEX_LENGTH,TABLE_ROWS,concat (DATA_LENGTH+INDEX_LENGTH) / round ((DATA_LENGTH+INDEX_LENGTH) / 1024)), 'MB') as data

FROM information_schema.tables WHERE TABLE_SCHEMA='zabbix' ORDER BY DATA_LENGTH+INDEX_LENGTH desc

9. Query the size of the specified table in the specified database (take the history table of the zabbix database as an example):

Select concat (round (sum (data_length/1024/1024), 2), 'MB') as data from tables where table_schema='zabbix' and table_name='history'; ``

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