mysql_tableinfo

Langue: en

Version: 07/04/2007 (mandriva - 22/10/07)

Section: 1 (Commandes utilisateur)

 

NAME

mysql_tableinfo - generate database metadata

SYNOPSIS

mysql_tableinfo [options] db_name [db_like [tbl_like]]

DESCRIPTION

mysql_tableinfo

creates tables and populates them with database metadata. It uses SHOW DATABASES, SHOW TABLES, SHOW TABLE STATUS, SHOW COLUMNS, and SHOW INDEX to obtain the metadata.

In MySQL 5.0 and up, the INFORMATION_SCHEMA database contains the same kind of information in the SCHEMATA, TABLES, COLUMNS, and STATISTICS tables. See Chapter 20, The INFORMATION_SCHEMA Database.

Invoke mysql_tableinfo like this:

 shell> mysql_tableinfo [options] db_name [db_like [tbl_like]]
 

The db_name argument indicates which database mysql_tableinfo should use as the location for the metadata tables. The database will be created if it does not exist. The tables will be named db, tbl (or tbl_status), col, and idx.

If the db_like or tbl_like arguments are given, they are used as patterns and metadata is generated only for databases or tables that match the patterns. These arguments default to % if not given.

Examples:

 mysql_tableinfo info
 mysql_tableinfo info world
 mysql_tableinfo info mydb tmp%
 

Each of the commands stores information into tables in the info database. The first stores information for all databases and tables. The second stores information for all tables in the world database. The third stores information for tables in the mydb database that have names matching the pattern tmp%.

mysql_tableinfo supports the following options:

--help

Display a help message and exit.

--clear

Before populating each metadata table, drop it if it exists.

--clear-only

Similar to --clear, but exits after dropping the metadata tables to be populated.

--col

Generate column metadata into the col table.

--host=host_name, -h host_name

Connect to the MySQL server on the given host.

--idx

Generate index metadata into the idx table.

--password=password, -ppassword

The password to use when connecting to the server. Note that the password value is not optional for this option, unlike for other MySQL programs. You can use an option file to avoid giving the password on the command line.

Specifying a password on the command line should be considered insecure. See Section 6.6, "Keeping Your Password Secure".

--port=port_num, -P port_num

The TCP/IP port number to use for the connection.

--prefix=prefix_str

Add prefix_str at the beginning of each metadata table name.

--quiet, -q

Be silent except for errors.

--socket=path, -S path

The Unix socket file to use for the connection.

--tbl-status

Use SHOW TABLE STATUS instead of SHOW TABLES. This provides more complete information, but is slower.

--user=user_name, -u user_name

The MySQL username to use when connecting to the server.

Copyright 1997-2007 MySQL AB

This documentation is NOT distributed under a GPL license. Use of this documentation is subject to the following terms: You may create a printed copy of this documentation solely for your own personal use. Conversion to other formats is allowed as long as the actual content is not altered or edited in any way. You shall not publish or distribute this documentation in any form or on any media, except if you distribute the documentation in a manner similar to how MySQL disseminates it (that is, electronically for download on a Web site with the software) or on a CD-ROM or similar medium, provided however that the documentation is disseminated together with the software on the same medium. Any other use, such as any dissemination of printed copies or use of this documentation, in whole or in part, in another publication, requires the prior written consent from an authorized representative of MySQL AB. MySQL AB reserves any and all rights to this documentation not expressly granted above.

Please email <docs@mysql.com> for more information.

SEE ALSO

For more information, please refer to the MySQL Reference Manual, which may already be installed locally and which is also available online at http://dev.mysql.com/doc/.

AUTHOR

MySQL AB (http://www.mysql.com/). This software comes with no warranty.