mysql

mysql如何查询所有数据库表

小亿
81
2024-09-29 01:56:43
栏目: 云计算

在MySQL中,要查询所有数据库的表,可以使用以下命令:

SELECT table_schema AS 'Database', table_name 
FROM information_schema.tables 
WHERE table_schema NOT IN ('mysql', 'information_schema', 'performance_schema');

这条命令会从information_schema.tables表中获取所有非系统自带的数据库(如’mysql’,‘information_schema’,‘performance_schema’)的表名。information_schema是一个包含所有MySQL数据库元数据的模式。

执行此查询后,您将获得一个结果集,其中包含两列:‘Database’和’table_name’,分别表示数据库名称和表名称。

0
看了该问题的人还看了