MySQLStudy-MySQL tool mysqlshow_MySQL

Source: Internet
Author: User
Tags x509 cert
MySQLStudy-MySQL tool mysqlshowmmysqlshow customers can quickly find which databases exist, tables in the database, columns in the table or cable mysqlshow provides a command line interface for some SQL display statements

MySQL Study-MySQL tool mysqlshow

Mmysqlshow customers can quickly find the databases, tables in the database, columns or cables in the table.

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 issue them from a mysql client program.

Call mysqlshow as follows:
Shell> mysqlshow [option] [db_name [tbl_name [col_name]
  • If no database is provided, all matched databases are displayed.
  • If no table is provided, all matching tables in the database are displayed.
  • If no column is provided, all matching columns and column types in the table are displayed.

Case:

[root@mysrv mysql]# mysqlshow --helpmysqlshow  Ver 9.10 Distrib 5.1.66, for redhat-linux-gnu (x86_64)Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be 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 is shown.If no database is given then all matching databases are shown.If no table is given, then all matching tables in database are shown.If no column is given, then all matching columns and column types in tableare shown.Default options are read from the following files in the given order:/etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf The following groups are 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 file.--defaults-file=#       Only read default options from the given file #.--defaults-extra-file=# Read this file after the 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 about each table.  -k, --keys          Show keys for table.  -p, --password[=name]                       Password to use when connecting to server. If password is                      not given, it's solicited on the tty.  -P, --port=#        Port number to use for 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                      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                      hostname used when connecting. This option is disabled by                      default.  -u, --user=name     User for login if 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                        FALSEhost                              (No default value)status                            FALSEkeys                              FALSEport                              3306show-table-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 default value)ssl-verify-server-cert            FALSEuser                              (No default value)

1. do not specify the database to be viewed

[Root @ mysrv mysql] # mysqlshow-uroot-poracle
+ -------------------- +
| Databases |
+ -------------------- +
| Information_schema |
| Mysql |
| Mysqlslap |
| Performance_schema |
| Prod |
| Sakila |
| Test |
+ -------------------- +
2. specify the database to be viewed

[Root @ mysrv 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 |
+ --------------------------- +
[Root @ mysrv mysql] # mysqlshow-uroot-poracle prod
Database: prod
+ -------- +
| Tables |
+ -------- +
| T1 |
| T2 |
| T3 |
| T4 |
+ -------- +

3. view the specified

[Root @ mysrv 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 |
+ ------- + ------------- + ----------------- + ------ + ----- + --------- + ------- + --------------------------------- + --------- +

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.