重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

MySQL之数据库对象查看工具mysqlshow-创新互联

   mysqlshow:数据库对象查看工具,用来快速查找存在哪些数据库、数据库中的表、表中的列或索引。

目前创新互联公司已为1000+的企业提供了网站建设、域名、网站空间、网站托管、服务器托管、企业网站设计、秦淮网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

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

     -k        显示指定的表中的索引

      -i        显示表的状态信息

不带任何参数显示所有数据库

[root@www mysql-5.6.30]# mysqlshow

+--------------------+

|   Databases    |

+--------------------+

| information_schema |

| mysql        |

| performance_schema |

| test        |

+--------------------+

不指定数据库,显示数据库和表的统计信息

[root@www mysql-5.6.30]# mysqlshow --count

+--------------------+--------+--------------+

|   Databases    | Tables |  Total Rows  |

+--------------------+--------+--------------+

| information_schema |   59 |     13157 |

| mysql        |   28 |     2474 |

| performance_schema |   52 |     16615 |

| test        |    2 |      24 |

+--------------------+--------+--------------+

4 rows in set.

指定数据库,显示统计信息

[root@www mysql-5.6.30]# mysqlshow -uroot test --count

Database: test

+----------+----------+------------+

|  Tables  | Columns  | Total Rows |

+----------+----------+------------+

| backt118 |     4 |     12 |

| t118   |     4 |     12 |

+----------+----------+------------+

2 rows in set.

指定数据库和表,显示统计信息

[root@www mysql-5.6.30]# mysqlshow -uroot test t118 --count

Database: test  Table: t118  Rows: 12

+---------+----------+-----------------+------+-----+---------+-------+---------------------------------+---------+

| Field  | Type   | Collation    | Null | Key | Default | Extra | Privileges            | Comment |

+---------+----------+-----------------+------+-----+---------+-------+---------------------------------+---------+

| name   | char(10) | utf8_general_ci | YES  | MUL |     |    | select,insert,update,references |     |

| age   | int(3)  |         | YES  |   |     |    | select,insert,update,references |     |

| chushen | date   |         | YES  |   |     |    | select,insert,update,references |     |

| shengao | int(3)  |         | YES  |   |     |    | select,insert,update,references |     |

+---------+----------+-----------------+------+-----+---------+-------+---------------------------------+---------+

显示指定表所有的索引,前部分是表的结构,后部分是表的索引信息

[root@www mysql-5.6.30]# mysqlshow -uroot test t118 -k

Database: test  Table: t118

+---------+----------+-----------------+------+-----+---------+-------+---------------------------------+---------+

| Field  | Type   | Collation    | Null | Key | Default | Extra | Privileges            | Comment |

+---------+----------+-----------------+------+-----+---------+-------+---------------------------------+---------+

| name   | char(10) | utf8_general_ci | YES  | MUL |     |    | select,insert,update,references |     |

| age   | int(3)  |         | YES  |   |     |    | select,insert,update,references |     |

| chushen | date   |         | YES  |   |     |    | select,insert,update,references |     |

| shengao | int(3)  |         | YES  |   |     |    | select,insert,update,references |     |

+---------+----------+-----------------+------+-----+---------+-------+---------------------------------+---------+

+-------+------------+------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+

| Table | Non_unique | Key_name  | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |

+-------+------------+------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+

| t118  | 1      | index_name | 1       | name     | A     | 12      |      |     | YES  | BTREE    |     |        |

| t118  | 1      | index_ccc  | 1       | name     | A     | 12      |      |     | YES  | BTREE    |     |        |

+-------+------------+------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+

显示表的状态信息

[root@www mysql-5.6.30]# mysqlshow -i -uroot test t118

Database: test  Wildcard: t118

+------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------+

| 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 |

+------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------+

| t118 | InnoDB | 10    | Compact   | 12  | 1365      | 16384    | 0        | 0       | 0     |         | 2017-04-29 22:33:47 |       |       | utf8_general_ci |      |         |     |

+------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------+

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网站题目:MySQL之数据库对象查看工具mysqlshow-创新互联
URL分享:http://cqcxhl.com/article/ddcsgc.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP