MySQL系列:2 查看某个数据库的所有表

2025-09-22 17:34:184633

方法一:

SQL> use database_name;

SQL> show tables;

解释: 先使用use命令切换默认数据库,再用show tables命令查看数据库的所有表。

结果:

方法二:

select * from information_schema.tables where table_schema = 'zavier';

解释: 数据库information_schema中有个表:tables,存储了当前mysql实例的所有表信息。包括其表名(table_name)、数据库名(table_schema)、存储引擎(engine)等;

结果:

Mysql版本说明:

jwllinux@jwlLinux ~ $ mysql -V

mysql Ver 14.14 Distrib 5.7.24, for Linux (i686) using EditLine wrapper

友情链接