MySQL Study--mysql Tool mysqlshow

Source: Internet
Author: User
Tags openssl x509 cert

MySQL Study--mysql tool Mysqlshow

mmysqlshow customers can use to quickly find out which databases exist, the tables in the database, the columns in the table, or the cable

mysqlshow provides a command-line interface for some SQL display statements. The same information can be obtained by directly using those statements. For example, you can send them out from a MySQL client program.

Call like thisMysqlshow:
shell>  Mysqlshow[ option ] [db_name  [tbl_name  [col_name ] "
    • If no database is given, all matching databases are displayed.
    • If no table is given, all matching tables in the database are displayed.
    • If no columns are given, all matching columns column types in the table are displayed.

Case:

[[email protected] mysql]# mysqlshow--helpmysqlshow Ver 9.10 distrib 5.1.66, for Redhat-linux-gnu (x86_64) Copyrigh T (c) +, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Shows the structure of a MySQL database (databases, tables, and columns). usage:mysqlshow [OPTIONS] [Database [table] [column]]]if last argument contains a shell or SQL wildcard (*,?,% or _) then Onlywhat ' s matched by the wildcard are shown. If no database is given and all matching databases is shown. If No table is given, then all matching tables in database is shown. If No column is given, then all matching columns and column types in Tableare shown.  Default options is read from the following files in the given order:/etc/mysql/my.cnf/etc/my.cnf ~/.my.cnf the following Groups is read:mysqlshow clientthe following options may be given as the first argument:--print-defAults Print The program argument list and Exit.--no-defaults Don ' t read default options from any option F ile.--defaults-file=# only read default options from the given file #.--defaults-extra-file=# read this file after T  He global files are read.  -C,--character-sets-dir=name Directory for character set files.  --default-character-set=name Set the default character set.  --count Show number of rows per table (may be slow for non-myisam tables).  -C,--compress use compression in Server/client protocol. -#,--debug[=name] Output debug Log.  Often this is ' d:t:o,filename '.  --debug-check check memory and open file usage at exit.  --debug-info Print some debug info at exit.  -?,--Help Display this help and exit.  -H,--host=name Connect to host.  -I,--status shows a lot of extra information on each table. -K,--keys Show keys for table.  -P,--password[=name] password to if connecting to server.  If password is not given, it's solicited on the TTY. -P,--port=# port number to connection or 0 for default to, in order of preference, my  . CNF, $MYSQL _tcp_port,/etc/services, built-in default (3306).  --protocol=name the protocol to use for connection (TCP, socket, pipe, memory).  -T,--show-table-type Show Table Type column.  -S,--socket=name the socket file to use for connection. --SSL Enable SSL for connection (automatically enabled with the other flags).  Disable with--skip-ssl.  --ssl-ca=name CA file in PEM format (check OpenSSL docs, implies--ssl).  --ssl-capath=name CA directory (check OpenSSL docs, implies--ssl).  --ssl-cert=name X509 cert in PEM format (implies--ssl). --ssl-cipher=name SSL CIPher to use (implies--ssl).  --ssl-key=name X509 key in PEM format (implies--ssl). --ssl-verify-server-cert Verify server ' s "Common Name" in its cert against host Name used when connecting.  This option was disabled by default.  -U,--user=name user for login if is not current user. -V,--verbose more verbose output;  You can use this multiple times to get even more verbose output. -V,--version Output version information and exit. Variables (--variable-name=value) and Boolean options {false| TRUE} Value (after reading options)--------------------------------------------------------------                             Character-sets-dir (No default value) Default-character-set Latin1count Falsecompress Falsedebug-check Falsedebug-info F Alsehost (No default value) StATUs Falsekeys Falseport 3306show-tab Le-type Falsesocket/tmp/mysql.sockssl Falsessl                          -CA (no default value) Ssl-capath (no default value) Ssl-cert (no default value) Ssl-cipher (no default value) Ssl-key (no D Efault value) Ssl-verify-server-cert falseuser (No default value) <strong>< /strong>

1. Do not specify the database to view

[Email protected] mysql]# mysqlshow-uroot-poracle
+--------------------+
| Databases |
+--------------------+
| Information_schema |
| MySQL |
| Mysqlslap |
| Performance_schema |
| Prod |
| Sakila |
| Test |
+--------------------+
2. Specify the database to be viewed

[[email protected] mysql]# mysqlshow-uroot-poracle MySQL
Database:mysql
+---------------------------+
| Tables |
+---------------------------+
| Columns_priv |
| db |
| Event |
| Func |
| General_log |
| Help_category |
| Help_keyword |
| help_relation |
| Help_topic |
| Host |
| Innodb_index_stats |
| Innodb_table_stats |
| Ndb_binlog_index |
| Plugin |
| Proc |
| Procs_priv |
| Proxies_priv |
| Servers |
| Slave_master_info |
| Slave_relay_log_info |
| Slave_worker_info |
| Slow_log |
| Tables_priv |
| Time_zone |
| Time_zone_leap_second |
| Time_zone_name |
| time_zone_transition |
| Time_zone_transition_type |
| user |
+---------------------------+
[email protected] mysql]# mysqlshow-uroot-poracle prod
Database:prod
+--------+
| Tables |
+--------+
| T1 |
| T2 |
| T3 |
| T4 |
+--------+

3. View the specified

[email protected] mysql]# mysqlshow-uroot-poracle prod t1
Database:prod TABLE:T1
+-------+-------------+-------------------+------+-----+---------+-------+---------------------------------+--- ------+
| Field | Type | Collation | Null | Key | Default | Extra | privileges | Comment |
+-------+-------------+-------------------+------+-----+---------+-------+---------------------------------+--- ------+
| ID |                   Int (11) | | NO | PRI |       0 | |         select,insert,update,references | |
| name | varchar (10) | Latin1_swedish_ci |     YES |         |       | |         select,insert,update,references | |
+-------+-------------+-------------------+------+-----+---------+-------+---------------------------------+--- ------+


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

MySQL Study--mysql Tool mysqlshow

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.