mysqlshow是mysql客户端对象查看工具,可以用来查看数据库、数据库中的表、表中的列、索引等。

shell > mysqlshow [options] [db_name [tbl_name [column_name]]]

如果不加任何选项,默认就是显示所有数据库。

# mysqlshow -uroot -p
Enter password: 
+--------------------+
|     Databases      |
+--------------------+
| information_schema |
| data               |
| mysql              |
| performance_schema |
| test               |
+--------------------+

2.mysqlshow命令的常用选项

--count:显示数据库和表的统计信息

如果不指定数据库,则显示每个数据库的表数量、记录数量;如果指定了数据库,则显示数据库的每个表名、字段数量、记录数量;如果指定了某个数据库的某张表,将会显示表的字段信息。

# mysqlshow -uroot -p --count   --未指定任何数据库
Enter password: 
+--------------------+--------+--------------+
|     Databases      | Tables |  Total Rows  |
+--------------------+--------+--------------+
| information_schema |     59 |        13124 |
| data               |      0 |            0 |
| mysql              |     28 |         2466 |
| performance_schema |     52 |        15956 |
| test               |      1 |            2 |
+--------------------+--------+--------------+
# mysqlshow -uroot -p test --count  --指定test数据库
Enter password: 
Database: test
+--------+----------+------------+
| Tables | Columns  | Total Rows |
+--------+----------+------------+
| t1     |        1 |          2 |
+--------+----------+------------+
# mysqlshow -uroot -p mysql user --count  --指定mysql数据库的user表
Enter password: 
Database: mysql  Table: user  Rows: 6
....结果省略.... 

-k, --keys:显示指定表中的所有索引

该选项显示两部分内容:一是指定表的表结构,二是指定表的当前索引信息。

-i, --status:显示指定表的状态信息

 

相关文章:

  • 2021-05-25
  • 2022-12-23
  • 2021-12-16
  • 2022-01-07
  • 2021-12-20
  • 2022-12-23
  • 2021-10-03
  • 2021-11-21
猜你喜欢
  • 2021-06-09
  • 2021-11-28
  • 2021-11-29
  • 2021-04-11
  • 2022-02-21
  • 2021-07-09
  • 2022-12-23
相关资源
相似解决方案