Linux基础命令---mysqlshow显示数据库

mysqlshow

mysqlshow 是一个客户端的程序,它可以显示数据库的信息、表信息、字段信息。

此命令的适用范围:RedHat、RHEL、Ubuntu、CentOS、Fedora。

 

1 、语法

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

 

2 、选项参数列表

选项

说明

- ? | --help

显示帮助信息

--bind-address = ip

绑定ip

--character-sets-dir

默认的字符集目录

-i | --status

显示表格的额外信息

-count

显示表中的行数

-C | --compress

在服务器和客户端之间使用压缩语句

-P | --port

指定端口

--protocol

指定协议

-v | --verbose

显示详细过程

-V | --version

显示版本信息

-u | --user

指定用户

-p | --password

指定密码

 

3 、实例

1 )查看有哪些数据库

[root@localhost ~]#  mysqlshow -u root –p              // 显示有哪些数据库

Enter password: 

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

|     Databases      |

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

| information_schema |

| david              |

| discuz             |

| drupal             |

| mediawiki          |

| mysql              |

| phpmyvisites       |

| test               |

| test01             |

| test02             |

| wordpress          |

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

2 )查看数据库中有哪些表

[root@localhost ~]#  mysqlshow -u root -p test               // 显示数据库 test 的信息

Enter password: 

Database: test

+--------+

| Tables |

+--------+

| wj     |

+--------+

3 )查看表中有哪些字段

[root@localhost ~]#  mysqlshow -u root -p test wj              // 显示数据库 test 中的表 wj 的信息

Enter password: 

Database: test  Table: wj

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

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

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

| id    | int(11) |                   | NO   |     |         |       | select,insert,update,references |         |

| name  | text    | latin1_swedish_ci | NO   |    |         |       | select,insert,update,references |         |

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

 

      做了一个Linux学习的平台,目前出来一个雏形,各位可以参考使用
      链接:https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ 密码:n7bk

     



请使用浏览器的分享功能分享到微信等