mysqlshow------命令行工具

文章目录

      • 语法
      • 参数
      • 实例
  • 1、查询数据库数量、表数量、字段数量
  • 2、查询指定数据库下的表信息
  • 3、查看数据库中表的详细信息


语法

mysqlshow [options] [db_name [tbl_name [col_name]]]

参数

–count
-i

实例

1、查询数据库数量、表数量、字段数量

[root@mysql5 ~]# mysqlshow -uroot -proot --count
mysqlshow: [Warning] Using a password on the command line interface can be insecure.
±-------------------±-------±-------------+
| Databases | Tables | Total Rows |
±-------------------±-------±-------------+
| information_schema | 61 | 544926 |
| a | 0 | 0 |
| database | 0 | 0 |
| hr | 13 | 2974084 |
| mysql | 31 | 3549 |
| newschema | 0 | 0 |
| performance_schema | 87 | 44939 |
| sys | 101 | 4734 |
| test | 0 | 0 |
| test01 | 0 | 0 |
±-------------------±-------±-------------+


2、查询指定数据库下的表信息

[root@mysql5 ~]# mysqlshow -uroot -proot hr emp --count
mysqlshow: [Warning] Using a password on the command line interface can be insecure.
Database: hr Table: emp Rows: 3
±----------------±------------±-------------------±-----±----±--------±------±--------------------------------±--------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
±----------------±------------±-------------------±-----±----±--------±------±--------------------------------±--------+
| department_id | int(4) | | NO | | | | select,insert,update,references | |
| department_name | varchar(30) | utf8mb4_general_ci | YES | | | | select,insert,update,references | |
| manager_id | int(6) | | YES | | | | select,insert,update,references | |
| location_id | int(4) | | YES | | | | select,insert,update,references | |
±----------------±------------±-------------------±-----±----±--------±------±--------------------------------±--------+


3、查看数据库中表的详细信息

[root@mysql5 ~]# mysqlshow -uroot -proot hr emp -i
mysqlshow: [Warning] Using a password on the command line interface can be insecure.
Database: hr Wildcard: emp
±-----±-------±--------±-----------±-----±---------------±------------±----------------±-------------±----------±---------------±--------------------±------------±-----------±-------------------±---------±---------------±--------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
±-----±-------±--------±-----------±-----±---------------±------------±----------------±-------------±----------±---------------±--------------------±------------±-----------±-------------------±---------±---------------±--------+
| emp | InnoDB | 10 | Dynamic | 4 | 4096 | 16384 | 0 | 0 | 0 | | 2023-07-09 01:43:40 | | | utf8mb4_general_ci | | | |
±-----±-------±--------±-----------±-----±---------------±------------±----------------±-------------±----------±---------------±--------------------±------------±-----------±-------------------±---------±---------------±--------+

你可能感兴趣的:(mysql命令行工具,mysql,数据库)