rhel4 mysql 5.5_檢視業務資料庫的表名及表列_管理

wisdomone1發表於2010-06-18
[root@localhost /]# mysql -h192.168.2.213 -uyisile -pdfyd8088
mysql: Unknown OS character set 'GB18030'.
mysql: Switching to the default character set 'latin1'.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2440
Server version: 5.5.0-m2-community-log MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cms_hzdfyd         |
| mysql              |
| test               |
| yisile             |
| yisile_db          |
| yisile_sns         |
| yisilecms          |
+--------------------+
8 rows in set (0.00 sec)
mysql> use information_schema;  #這東東相當於oracle system表空間, 裡面一堆表,用於內部管理,相當於oracle的資料字典
Database changed
mysql> show tables;
+---------------------------------------+
| Tables_in_information_schema          |
+---------------------------------------+
| CHARACTER_SETS                        |
| COLLATIONS                            |
| COLLATION_CHARACTER_SET_APPLICABILITY |
| COLUMNS                               |
| COLUMN_PRIVILEGES                     |
| ENGINES                               |
| EVENTS                                |
| FILES                                 |
| GLOBAL_STATUS                         |
| GLOBAL_VARIABLES                      |
| KEY_COLUMN_USAGE                      |
| PARTITIONS                            |
| PLUGINS                               |
| PROCESSLIST                           |
| PROFILING                             |
| REFERENTIAL_CONSTRAINTS               |
| ROUTINES                              |
| SCHEMATA                              |
| SCHEMA_PRIVILEGES                     |
| SESSION_STATUS                        |
| SESSION_VARIABLES                     |
| STATISTICS                            |
| TABLES                                |
| TABLE_CONSTRAINTS                     |
| TABLE_PRIVILEGES                      |
| TRIGGERS                              |
| USER_PRIVILEGES                       |
| VIEWS                                 |
| INNODB_CMP_RESET                      |
| INNODB_TRX                            |
| INNODB_CMPMEM_RESET                   |
| INNODB_LOCK_WAITS                     |
| INNODB_CMPMEM                         |
| INNODB_CMP                            |
| INNODB_LOCKS                          |
+---------------------------------------+
35 rows in set (0.00 sec)
mysql> select * from columns where table_schema='yisile' and table_name='yisile_notice';#檢視yisile資料庫yisile_notice表的所有列相關資訊
+---------------+--------------+---------------+-------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+-------------------+--------------+------------+----------------+---------------------------------+----------------+
| TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME    | COLUMN_NAME | ORDINAL_POSITION | COLUMN_DEFAULT | IS_NULLABLE | DATA_TYPE | CHARACTER_MAXIMUM_LENGTH | CHARACTER_OCTET_LENGTH | NUMERIC_PRECISION | NUMERIC_SCALE | CHARACTER_SET_NAME | COLLATION_NAME    | COLUMN_TYPE  | COLUMN_KEY | EXTRA          | PRIVILEGES                      | COLUMN_COMMENT |
+---------------+--------------+---------------+-------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+-------------------+--------------+------------+----------------+---------------------------------+----------------+
| def           | yisile       | yisile_notice | ID          |                1 | NULL           | NO          | bigint    |                     NULL |                   NULL |                19 |             0 | NULL               | NULL              | bigint(20)   | PRI        | auto_increment | select,insert,update,references |                |
| def           | yisile       | yisile_notice | TITLE       |                2 | NULL           | NO          | varchar   |                       50 |                    100 |              NULL |          NULL | gb2312             | gb2312_chinese_ci | varchar(50)  |            |                | select,insert,update,references |                |
| def           | yisile       | yisile_notice | CONTENT     |                3 | NULL           | YES         | varchar   |                      255 |                    510 |              NULL |          NULL | gb2312             | gb2312_chinese_ci | varchar(255) |            |                | select,insert,update,references |                |
| def           | yisile       | yisile_notice | POINT_COUNT |                4 | NULL           | YES         | int       |                     NULL |                   NULL |                10 |             0 | NULL               | NULL              | int(11)      |            |                | select,insert,update,references |                |
| def           | yisile       | yisile_notice | createTime  |                5 | NULL           | YES         | datetime  |                     NULL |                   NULL |              NULL |          NULL | NULL               | NULL              | datetime     |            |                | select,insert,update,references |                |
| def           | yisile       | yisile_notice | CREATOR     |                6 | NULL           | YES         | varchar   |                       50 |                    100 |              NULL |          NULL | gb2312             | gb2312_chinese_ci | varchar(50)  |            |                | select,insert,update,references |                |
| def           | yisile       | yisile_notice | MODIFIER    |                7 | NULL           | YES         | varchar   |                       50 |                    100 |              NULL |          NULL | gb2312             | gb2312_chinese_ci | varchar(50)  |            |                | select,insert,update,references |                |
| def           | yisile       | yisile_notice | MODIFY_TIME |                8 | NULL           | YES         | datetime  |                     NULL |                   NULL |              NULL |          NULL | NULL               | NULL              | datetime     |            |                | select,insert,update,references |                |
| def           | yisile       | yisile_notice | ROLE_ID     |                9 | NULL           | YES         | bigint    |                     NULL |                   NULL |                19 |             0 | NULL               | NULL              | bigint(20)   |            |                | select,insert,update,references |                |
| def           | yisile       | yisile_notice | USER_ID     |               10 | NULL           | YES         | bigint    |                     NULL |                   NULL |                19 |             0 | NULL               | NULL              | bigint(20)   |            |                | select,insert,update,references |                |
| def           | yisile       | yisile_notice | TYPE_ID     |               11 | NULL           | YES         | bigint    |                     NULL |                   NULL |                19 |             0 | NULL               | NULL              | bigint(20)   | MUL        |                | select,insert,update,references |                |
+---------------+--------------+---------------+-------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+---------------+--------------------+-------------------+--------------+------------+----------------+---------------------------------+----------------+
11 rows in set (0.00 sec)
mysql>

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-665619/,如需轉載,請註明出處,否則將追究法律責任。

相關文章