gpt4 book ai didi

mysql查询从多个数据库中搜索表名

转载 作者:行者123 更新时间:2023-11-29 12:04:28 28 4
gpt4 key购买 nike

我在搜索特定表名时遇到问题。我的服务器上有大约 50 个数据库,我希望搜索一个表名,假设 X 是在其中创建的所有数据库。有没有直接通过phpMyAdmin找到MYSQL中X表所在的确切数据库。

任何帮助将不胜感激。谢谢

最佳答案

您可以查询information_schema数据库来获取此信息。以下查询将返回所有数据库的名称,其中包含表 your_table_name

SELECT `TABLE_SCHEMA` 
FROM `information_schema`.`TABLES`
WHERE `TABLE_NAME` = 'your_table_name'

我希望这就是您正在寻找的内容。

根据MySQLdocumentation关于information_schema数据库,

INFORMATION_SCHEMA provides access to database metadata.

Metadata is data about the data, such as the name of a database or table, the data type of a column, or access privileges. Other terms that sometimes are used for this information are data dictionary and system catalog.

关于mysql查询从多个数据库中搜索表名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31780147/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com