'\" t .\" Title: \fBmysqlmetagrep\fR .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 08/01/2016 .\" Manual: MySQL Utilities .\" Source: MySQL 1.6.3 .\" Language: English .\" .TH "\FBMYSQLMETAGREP\FR" "1" "08/01/2016" "MySQL 1\&.6\&.3" "MySQL Utilities" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" mysqlmetagrep \- Search Database Object Definitions .SH "SYNOPSIS" .HP \w'\fBmysqlmetagrep\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIpattern\fR\fR\fB\ |\ \fR\fB\fIserver\fR\fR\fB]\ \&.\&.\&.\fR\ 'u \fBmysqlmetagrep [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIpattern\fR\fR\fB | \fR\fB\fIserver\fR\fR\fB] \&.\&.\&.\fR .SH "DESCRIPTION" .PP This utility searches for objects matching a given pattern on all the servers specified using instances of the \fB\-\-server\fR option\&. It produces output that displays the matching objects\&. By default, the first non\-option argument is taken to be the pattern unless the \fB\-\-pattern\fR option is given\&. If the \fB\-\-pattern\fR option is given, then all non\-option arguments are treated as connection specifications\&. .PP Internally, the utility generates an SQL statement for searching the necessary tables in the \fBINFORMATION_SCHEMA\fR database on the designated servers, and then executes it before collecting the result and printing it as a table\&. Use the \fB\-\-sql\fR option to have \fBmysqlmetagrep\fR display the statement, rather than execute it\&. This can be useful if you want to feed the output of the statement to another application, such as the \fBmysql\fR client command\-line tool\&. .PP The MySQL server supports two forms of patterns when matching strings: SQL Simple Patterns (used with the \fBLIKE\fR operator) and POSIX Regular Expressions (used with the \fBREGEXP\fR operator)\&. .PP By default, the utility uses the \fBLIKE\fR operator to match the name (and optionally, the body) of objects\&. To use the \fBREGEXP\fR operator instead, use the \fB\-\-regexp\fR option\&. .if n \{\ .sp .\} .RS 4 .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBNote\fR .ps -1 .br .PP Because the \fBREGEXP\fR operator does substring searching, it is necessary to anchor the expression to the beginning of the string if you want to match the beginning of the string\&. .sp .5v .RE .PP To specify how to display output, use one of the following values with the \fB\-\-format\fR option: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBgrid\fR (default) .sp Display output in grid or table format like that of the \fBmysql\fR client command\-line tool\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBcsv\fR .sp Display output in comma\-separated values format\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBtab\fR .sp Display output in tab\-separated format\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBvertical\fR .sp Display output in single\-column format like that of the \eG command for the \fBmysql\fR client command\-line tool\&. .RE SQL Simple Patterns.PP The simple patterns defined by the SQL standard consist of a string of characters with two characters that have special meaning: % (percent) matches zero or more characters, and _ (underscore) matches exactly one character\&. .PP For example: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \*(Aqjohn%\*(Aq .sp Match any string that starts with \*(Aqjohn\*(Aq\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \*(Aq%doe%\*(Aq .sp Match any string containing the word \*(Aqdoe\*(Aq\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \*(Aq%_\*(Aq .sp Match any string consisting of one or more characters\&. .RE POSIX Regular Expressions.PP POSIX regular expressions are more powerful than the simple patterns defined in the SQL standard\&. A regular expression is a string of characters, optionally containing characters with special meaning\&. .PP Documenting these regular expressions goes beyond the scope of this manual, but the full syntax is described in the \m[blue]\fBMySQL manual\fR\m[]\&\s-2\u[1]\d\s+2 and other locations, such as executing \*(Aqman regex\*(Aq in your terminal\&. .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB\&.\fR .sp Match any character\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB^\fR .sp Match the beginning of a string\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB$\fR .sp Match the end of a string\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB[axy]\fR .sp Match \fBa\fR, \fBx\fR, or \fBy\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB[a\-f]\fR .sp Match any character in the range \fBa\fR to \fBf\fR (that is, \fBa\fR, \fBb\fR, \fBc\fR, \fBd\fR, \fBe\fR, or \fBf\fR)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB[^axy]\fR .sp Match any character \fIexcept\fR \fBa\fR, \fBx\fR, or \fBy\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBa*\fR .sp Match a sequence of zero or more \fBa\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBa+\fR .sp Match a sequence of one or more \fBa\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBa?\fR .sp Match zero or one \fBa\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBab|cd\fR .sp Match \fBab\fR or \fBcd\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBa{5}\fR .sp Match five instances of \fBa\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fBa{2,5}\fR .sp Match from two to five instances of \fBa\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \fB(abc)+\fR .sp Match one or more repetitions of \fBabc\fR\&. .RE OPTIONS.PP \fBmysqlmetagrep\fR accepts the following command\-line options: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-help .sp Display a help message and exit\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-license .sp Display license information and exit\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-body, \-b .sp Search the body of stored programs (procedures, functions, triggers, and events)\&. The default is to match only the name\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-character\-set= .sp Sets the client character set\&. The default is retrieved from the server variable character_set_client\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-database= .sp Look only in databases matching this pattern\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-format=, \-f .sp Specify the output display format\&. Permitted format values are \fBgrid\fR (default), \fBcsv\fR, \fBtab\fR, and \fBvertical\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-object\-types=, \-\-search\-objects= .sp Search only the object types named in \fItypes\fR, which is a comma\-separated list of one or more of the values \fBdatabase\fR, \fBtrigger\fR, \fBuser\fR, \fBroutine\fR, \fBcolumn\fR, \fBtable\fR, \fBpartition\fR, \fBevent\fR and \fBview\fR\&. .sp The default is to search in objects of all types\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-pattern=, \-e= .sp The pattern to use when matching\&. This is required when the first non\-option argument looks like a connection specification rather than a pattern\&. .sp If the \fB\-\-pattern\fR option is given, the first non\-option argument is treated as a connection specifier, not as a pattern\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-regexp, \-\-basic\-regexp, \-G .sp Perform pattern matches using the \fBREGEXP\fR operator\&. The default is to use \fBLIKE\fR for matching\&. This affects the \fB\-\-database\fR and \fB\-\-pattern\fR options\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-server= .sp Connection information for a server\&. Use this option multiple times to search multiple servers\&. .sp To connect to a server, it is necessary to specify connection parameters such as the user name, host name, password, and either a port or socket\&. MySQL Utilities provides a number of ways to supply this information\&. All of the methods require specifying your choice via a command\-line option such as \-\-server, \-\-master, \-\-slave, etc\&. The methods include the following in order of most secure to least secure\&. .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Use login\-paths from your \&.mylogin\&.cnf file (encrypted, not visible)\&. Example : <\fIlogin\-path\fR>[:<\fIport\fR>][:<\fIsocket\fR>] .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Use a configuration file (unencrypted, not visible) Note: available in release\-1\&.5\&.0\&. Example : <\fIconfiguration\-file\-path\fR>[:<\fIsection\fR>] .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Specify the data on the command\-line (unencrypted, visible)\&. Example : <\fIuser\fR>[:<\fIpasswd\fR>]@<\fIhost\fR>[:<\fIport\fR>][:<\fIsocket\fR>] .RE .sp .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-sql, \-\-print\-sql, \-p .sp Print rather than executing the SQL code that would be executed to find all matching objects\&. This can be useful to save the statement for later execution or to use it as input for other programs\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-ssl\-ca .sp The path to a file that contains a list of trusted SSL CAs\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-ssl\-cert .sp The name of the SSL certificate file to use for establishing a secure connection\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-ssl\-cert .sp The name of the SSL key file to use for establishing a secure connection\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-ssl .sp Specifies if the server connection requires use of SSL\&. If an encrypted connection cannot be established, the connection attempt fails\&. Default setting is 0 (SSL not required)\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} \-\-version .sp Display version information and exit\&. .RE NOTES.PP For the \fB\-\-format\fR option, the permitted values are not case sensitive\&. In addition, values may be specified as any unambiguous prefix of a valid value\&. For example, \fB\-\-format=g\fR specifies the grid format\&. An error occurs if a prefix matches more than one valid value\&. .PP The path to the MySQL client tools should be included in the PATH environment variable in order to use the authentication mechanism with login\-paths\&. This will allow the utility to use the \fBmy_print_defaults\fR tools which is required to read the login\-path values from the login configuration file (\&.mylogin\&.cnf)\&. EXAMPLES.PP Find all objects with a name that matches the pattern \*(Aqt_\*(Aq (the letter t followed by any single character): .sp .if n \{\ .RS 4 .\} .nf shell> \fBmysqlmetagrep \-\-pattern="t_" \-\-server=john@localhost\fR +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+ | Connection | Object Type | Object Name | Database | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+ | john:*@localhost:3306 | TABLE | t1 | test | | john:*@localhost:3306 | TABLE | t2 | test | | john:*@localhost:3306 | TABLE | tm | test | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+ .fi .if n \{\ .RE .\} .PP To find all object that contain \*(Aqt2\*(Aq in the name or the body (for routines, triggers, and events): .sp .if n \{\ .RS 4 .\} .nf shell> \fBmysqlmetagrep \-b \-\-pattern="%t2%" \-\-server=john@localhost:3306\fR +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+ | Connection | Object Type | Object Name | Database | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+ | john:*@localhost:3306 | TRIGGER | tr_foo | test | | john:*@localhost:3306 | TABLE | t2 | test | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+ .fi .if n \{\ .RE .\} .PP In the preceding output, the trigger name does not match the pattern, but is displayed because its body does\&. .PP This is the same as the previous example, but using the \fBREGEXP\fR operator\&. Note that in the pattern it is not necessary to add wildcards before or after t2: .sp .if n \{\ .RS 4 .\} .nf shell> \fBmysqlmetagrep \-Gb \-\-pattern="t2" \-\-server=john@localhost\fR +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+ | Connection | Object Type | Object Name | Database | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+ | root:*@localhost:3306 | TRIGGER | tr_foo | test | | root:*@localhost:3306 | TABLE | t2 | test | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+ .fi .if n \{\ .RE .\} .sp PERMISSIONS REQUIRED.PP The user must have the SELECT privilege on the mysql database\&. .SH "COPYRIGHT" .br .PP Copyright \(co 2006, 2016, Oracle and/or its affiliates. All rights reserved. .PP This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. .PP This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/. .sp .SH "NOTES" .IP " 1." 4 MySQL manual .RS 4 \%http://dev.mysql.com/doc/mysql/en/regexp.html .RE .SH "SEE ALSO" For more information, please refer to the MySQL Utilities and Fabric documentation, which is available online at http://dev.mysql.com/doc/index-utils-fabric.html .SH AUTHOR Oracle Corporation (http://dev.mysql.com/).