天涯客*Blog

MySQL Study之–MySQL工具mysqlshow

mmysqlshow客户可用来很快地查找存在哪些数据库,数据库中的表,表中的列或索

mysqlshow为一些SQL显示语句提供了一个命令行界面。相同的信息可以通过直接使用那些语句获得。例如,你可以从mysql客户程序发出它们。

象这样调用mysqlshow:shell>mysqlshow[选项] [db_name[tbl_name[col_name]] 如果没有给出数据库,显示所有匹配的数据库。 如果没有给出表,,显示数据库中所有匹配的表。 如果没有给出列,显示表中所有匹配的列和列类型。

案例:

[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-defaultsPrint the program argument list and exit.–no-defaultsDon'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=nameDirectory for character set files. –default-character-set=nameSet the default character set. –countShow number of rows per table (may be slow for non-MyISAMtables). -C, –compressUse compression in server/client protocol. -#, –debug[=name] Output debug log. Often this is 'd:t:o,filename'. –debug-checkCheck memory and open file usage at exit. –debug-infoPrint some debug info at exit. -?, –helpDisplay this help and exit. -h, –host=nameConnect to host. -i, –statusShows a lot of extra information about each table. -k, –keysShow keys for table. -p, –password[=name]Password to use when connecting to server. If password isnot given, it's solicited on the tty. -P, –port=#Port number to use for connection or 0 for default to, inorder of preference, my.cnf, $MYSQL_TCP_PORT,/etc/services, built-in default (3306). –protocol=nameThe protocol to use for connection (tcp, socket, pipe,memory). -t, –show-table-typeShow table type column. -S, –socket=name The socket file to use for connection. –sslEnable SSL for connection (automatically enabled withother flags).Disable with –skip-ssl. –ssl-ca=nameCA file in PEM format (check OpenSSL docs, implies–ssl). –ssl-capath=name CA directory (check OpenSSL docs, implies –ssl). –ssl-cert=nameX509 cert in PEM format (implies –ssl). –ssl-cipher=name SSL cipher to use (implies –ssl). –ssl-key=nameX509 key in PEM format (implies –ssl). –ssl-verify-server-certVerify server's "Common Name" in its cert againsthostname used when connecting. This option is disabled bydefault. -u, –user=nameUser for login if not current user. -v, –verboseMore verbose output; you can use this multiple times toget even more verbose output. -V, –versionOutput 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-setlatin1countFALSEcompressFALSEdebug-checkFALSEdebug-infoFALSEhost(No default value)statusFALSEkeysFALSEport3306show-table-typeFALSEsocket/tmp/mysql.socksslFALSEssl-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-certFALSEuser(No default value)<strong></strong>

1、不指定查看的database

[root@mysrv mysql]# mysqlshow -uroot -poracle+——————–+| Databases |+——————–+| information_schema || mysql || mysqlslap || performance_schema || prod || sakila || test |+——————–+2、指定查看的database

不论你在什么时候结束,重要的是结束之後就不要悔恨

天涯客*Blog

相关文章:

你感兴趣的文章:

标签云: