品易云推流 关闭
文章详情页
文章 > MySQL > mysql怎么查询数据库中有多少表

mysql怎么查询数据库中有多少表

头像

yang

2020-05-06 13:19:424307浏览 · 0收藏 · 0评论

mysql中可以使用show tables或show tables from database_name命令查看当前数据库中有多少数据表。

查询数据库中表的方法步骤:

1、使用show databases查看有哪些数据库。

2、指定要查询的数据库

使用下面的命令即可:

USE <数据库名>

3、使用show tables或show tables from database_name命令查看数据库中有多少表。

示例:

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| component                 |
| db                        |
| default_roles             |
| engine_cost               |
| func                      |
| general_log               |
| global_grants             |
| gtid_executed             |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| innodb_index_stats        |
| innodb_table_stats        |
| password_history          |
| plugin                    |
| procs_priv                |
| proxies_priv              |
| role_edges                |
| 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                      |
+---------------------------+
33 rows in set (0.01 sec)

推荐:MySQL教程

关注

关注公众号,随时随地在线学习

本教程部分素材来源于网络,版权问题联系站长!

底部广告图