mysql怎么查看表及表结构
查看数据库中的表
show tables
示例:
mysql> SHOW TABLES;+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| engine_cost |
| event |
| func |
| general_log |
| gtid_executed |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| innodb_index_stats |
| innodb_table_stats |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| proxies_priv |
| server_cost |
| servers |
| slave_master_info |
| slave_relay_log_info |
| slave_worker_info |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
31 rows in set (0.00 sec)
查看表结构
desc table_name;
示例:
create table person(id int not null auto_increment primary key,
name varchar(8),
index ix__person__name (name));
desc person;
+-------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(8) | YES | MUL | NULL | |
+-------+------------+------+-----+---------+----------------+
推荐:MySQL教程
以上是 mysql怎么查看表及表结构 的全部内容, 来源链接: utcz.com/z/538793.html