MySQL 数据库命令之 mysqlshow -- 显示 MySQL 数据库相关信息
生活随笔
收集整理的這篇文章主要介紹了
MySQL 数据库命令之 mysqlshow -- 显示 MySQL 数据库相关信息
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
文章目錄
- 介紹
- 語(yǔ)法格式
- 常用選項(xiàng)
- 參考示例
- (一)顯示指定數(shù)據(jù)庫(kù)中的所有表的記錄數(shù)和列數(shù)
- (二)顯示指定數(shù)據(jù)庫(kù)中所有的數(shù)據(jù)表的額外信息
- (三)查看指定數(shù)據(jù)庫(kù)中的所有數(shù)據(jù)表
- (四)顯示所有的數(shù)據(jù)庫(kù)
- (五)統(tǒng)計(jì)數(shù)據(jù)庫(kù)表的列數(shù)和行數(shù)
- (六)顯示某個(gè)數(shù)據(jù)表的所有列信息
- (七)顯示表的鍵信息
介紹
mysqlshow 命令用于顯示 MySQL 服務(wù)器中的數(shù)據(jù)庫(kù)、表和列信息。
如果沒(méi)有指定數(shù)據(jù)庫(kù),則顯示所有匹配的數(shù)據(jù)庫(kù);如果沒(méi)有指定表,將顯示數(shù)據(jù)庫(kù)中所有匹配的表。如果沒(méi)有指定列,則顯示表中所有匹配的列。
語(yǔ)法格式
mysqlshow <選項(xiàng)> <參數(shù)>
參數(shù):指定要顯示的數(shù)據(jù)庫(kù)對(duì)象,可以是一個(gè)數(shù)據(jù)庫(kù)名,或者是數(shù)據(jù)庫(kù)名+表名,或者是數(shù)據(jù)庫(kù)名+表名+列名。
常用選項(xiàng)
| -h | MySQL服務(wù)器的IP地址或主機(jī)名 |
| -u | 連接MySQL服務(wù)器的用戶名 |
| -p | 連接MySQL服務(wù)器的密碼 |
| –count | 顯示每個(gè)數(shù)據(jù)表的行數(shù) |
| -k | 顯示數(shù)據(jù)庫(kù)表的索引,鍵 |
| -t | 顯示數(shù)據(jù)表的類(lèi)型 |
| -i | 顯示數(shù)據(jù)表的額外信息 |
參考示例
(一)顯示指定數(shù)據(jù)庫(kù)中的所有表的記錄數(shù)和列數(shù)
[root@htlwk0001host ~]# mysqlshow -hlocalhost -uroot -p --count -t production Enter password: Database: production +-------------------------+------------+----------+------------+ | Tables | table_type | Columns | Total Rows | +-------------------------+------------+----------+------------+ | td_appraise_dimension | BASE TABLE | 4 | 5 |(二)顯示指定數(shù)據(jù)庫(kù)中所有的數(shù)據(jù)表的額外信息
[root@htlwk0001host ~]# mysqlshow -hlocalhost -uroot -p --count -t -i production Enter password:(三)查看指定數(shù)據(jù)庫(kù)中的所有數(shù)據(jù)表
[root@htlwk0001host ~]# mysqlshow -hlocalhost -uroot -p -t production # -t 選項(xiàng)會(huì)把表的類(lèi)型也顯示出來(lái) Enter password: Database: production +-------------------------+------------+ | Tables | table_type | +-------------------------+------------+ | td_area | BASE TABLE | | td_dictionary | BASE TABLE | [root@htlwk0001host ~]# mysqlshow -hlocalhost -uroot -p production Enter password: Database: production(四)顯示所有的數(shù)據(jù)庫(kù)
[root@mysql mysqlhelp]# mysqlshow -uroot -p Enter password: +--------------------+ | Databases | +--------------------+ | information_schema | | mysql | | oldboy | | performance_schema | | sys | | test | | xinyong | +--------------------+(五)統(tǒng)計(jì)數(shù)據(jù)庫(kù)表的列數(shù)和行數(shù)
(六)顯示某個(gè)數(shù)據(jù)表的所有列信息
[root@mysql mysqlhelp]# mysqlshow -uroot -p production tf_user Enter password: Database: production Table: tf_user +-------+-------------+-----------------+------+-----+---------+----------------+---------------------------------+---------+ | Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment | +-------+-------------+-----------------+------+-----+---------+----------------+---------------------------------+---------+ | a | int(11) | | NO | PRI | | auto_increment | select,insert,update,references | | | b | varchar(30) | utf8_general_ci | YES | | | | select,insert,update,references | | +-------+-------------+-----------------+------+-----+---------+----------------+---------------------------------+---------+(七)顯示表的鍵信息
[root@mysql mysqlhelp]# mysqlshow -uroot -p -k production tf_user Enter password: Database: production Table: tf_user +-------+-------------+-----------------+------+-----+---------+----------------+---------------------------------+---------+ | Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment | +-------+-------------+-----------------+------+-----+---------+----------------+---------------------------------+---------+ | a | int(11) | | NO | PRI | | auto_increment | select,insert,update,references | | | b | varchar(30) | utf8_general_ci | 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 | +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | t | 0 | PRIMARY | 1 | a | A | 5 | | | | BTREE | | | +-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+總結(jié)
以上是生活随笔為你收集整理的MySQL 数据库命令之 mysqlshow -- 显示 MySQL 数据库相关信息的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Linux 命令之 ll -- 列出当前
- 下一篇: Linux 启动/重启/停止 MySQL