查看MySQL數(shù)據(jù)庫表的命令介紹
如果需要查看MySQL數(shù)據(jù)庫中都有哪些MySQL數(shù)據(jù)庫表,應(yīng)該如何實現(xiàn)呢?下面就為您介紹查看MySQL數(shù)據(jù)庫表的命令,供您參考。
進入MySQL Command line client下
查看當(dāng)前使用的數(shù)據(jù)庫:
mysql>select database();
mysql>status;
mysql>show tables;
mysql>show databases;//可以查看有哪些數(shù)據(jù)庫,返回數(shù)據(jù)庫名(databaseName)
mysql>use databaseName; //更換當(dāng)前使用的數(shù)據(jù)庫
mysql>show tables; //返回當(dāng)前數(shù)據(jù)庫下的所有表的名稱
或者也可以直接用以下命令
mysql>show tables from databaseName;//databaseName可以用show databases得來
mysql查看表結(jié)構(gòu)命令,如下:
desc 表名;
show columns from 表名;
或者
describe 表名;
show create table 表名;
或者
use information_schema
select * from columns where table_name='表名';
查看警告:
- Rows matched: 1 Changed: 0 Warnings: 1
- mysql> show warnings;
- +---------+------+-------------------------------------------+
- | Level | Code | Message |
- +---------+------+-------------------------------------------+
- | Warning | 1265 | Data truncated for column 'name' at row 3 |
- +---------+------+-------------------------------------------+
- 1 row in set
以上就是查看MySQL數(shù)據(jù)庫表的命令介紹。
【編輯推薦】