• 技术文章 >数据库 >MySQL

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

    yangyang2020-05-06 13:19:42原创4415

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

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

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

    2、指定要查询的数据库

    使用下面的命令即可:

    1

    USE <数据库名>

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

    示例:

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    21

    22

    23

    24

    25

    26

    27

    28

    29

    30

    31

    32

    33

    34

    35

    36

    37

    38

    39

    40

    41

    42

    43

    44

    45

    46

    47

    48

    49

    50

    51

    52

    53

    54

    55

    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教程

    专题推荐:mysql
    上一篇:mysql怎么查询是否存在指定表? 下一篇:mysql数据库怎么进入

    相关文章推荐

    • mysql怎么判断字段是否为空?• mysql存储过程乱码怎么解决?• mysql的删除语句怎么写?• 如何查看mysql的日志

    全部评论我要评论

    © 2021 Python学习网 苏ICP备2021003149号-1

  • 取消发布评论
  • 

    Python学习网