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.
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%
.
Table 4.13. mysql_tableinfo
Options
Format | Config File | Description | Introduction | Deprecated | Removed |
---|---|---|---|---|---|
--clear | clear | Before populating each metadata table, drop it if it exists | |||
--clear-only | clear-only | Similar to --clear, but exits after dropping the metadata tables to be populated. | |||
--col | col | Generate column metadata into the col table | |||
--help | Display help message and exit | ||||
--host=host_name | host | Connect to the MySQL server on the given host | |||
--idx | idx | Generate index metadata into the idx table | |||
--password=password | password | The password to use when connecting to the server -- not optional | |||
--port=port_num | port | The TCP/IP port number to use for the connection | |||
--prefix=prefix_str | prefix | Add prefix_str at the beginning of each metadata table name | |||
--quiet | quiet | Be silent except for errors | |||
--socket=path | socket | Display version information and exit | |||
--tbl-status | tbl-status | Use SHOW TABLE STATUS instead of SHOW TABLES | |||
--user=user_name, | user | The mysql_tableinfo user name to use when connecting to the server |
mysql_tableinfo supports the following options:
Display a help message and exit.
Before populating each metadata table, drop it if it exists.
Similar to --clear
,
but exits after dropping the metadata tables to be
populated.
Generate column metadata into the col
table.
--host=
,
host_name
-h
host_name
Connect to the MySQL server on the given host.
Generate index metadata into the idx
table.
--password=
,
password
-p
password
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.
Specifying a password on the command line should be considered insecure. See Section 5.4.2.2, “End-User Guidelines for Password Security”. You can use an option file to avoid giving the password on the command line.
--port=
,
port_num
-P
port_num
The TCP/IP port number to use for the connection.
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.
Use SHOW TABLE STATUS
instead
of SHOW TABLES
. This provides
more complete information, but is slower.
--user=
,
user_name
-u
user_name
The MySQL user name to use when connecting to the server.
User Comments
Add your own comment.