SQL SHOW TABLES 列出了一堆表,但无法使用它们进行 SELECT (没有这样的表)

发布于 2024-11-24 19:40:18 字数 1805 浏览 3 评论 0原文

我有一个名为 apsc 的数据库,如果我在其上运行 SHOW TABLES;,结果如下:

mysql> show tables;
+------------------------------------+
| Tables_in_apsc                     |
+------------------------------------+
| aps_application                    |
| aps_application_backup             |
| aps_application_resource           |
| aps_package                        |
| aps_package_configuration          |
| aps_package_global_setting         |
| aps_package_resource_configuration |
| aps_package_resource_setting       |
| aps_package_series                 |
| aps_package_service                |
| aps_registry_object                |
| aps_registry_object_setting        |
| aps_registry_object_tag            |
| aps_resource                       |
| aps_resource_backup                |
| aps_resource_requirement           |
| aps_resource_requirement_backup    |
| aps_settings_sequenses             |
+------------------------------------+
18 rows in set (0.00 sec)

但是,如果我运行 SELECT * FROM aps_application > 我明白了:

mysql> SELECT * FROM aps_application;
ERROR 1146 (42S02): Table 'apsc.aps_application' doesn't exist

在我的 /var/lib/mysql/apsc/ 目录中有一堆 .frm 文件,这让我相信这些表是 InnoDB。但是,如果它们只是在 /var/lib/mysql/apsc/ibdata1 中的数据/日志文件中损坏或丢失,它们应该显示为 table in use 或者什么不,因为我最近在使用其他 InnoDB 表时遇到了这个问题。

我相信这些表是 Plesk 的一部分,因为我在某个时候被数据库文件覆盖,并收到了有关缺少视图 aps_application 的错误。 Plesk 现在工作正常,所以我怀疑该表已损坏。

此外,SHOW CREATE TABLE aps_applicationSHOW CREATE VIEW aps_application 都失败,并出现与 select 相同的错误。

编辑:我以具有完全权限的 root 身份登录。为了检查这一点,我切换了表,并且 SELECT 工作得非常顺利。另外,如果我在 phpMyAdmin 中并选择此数据库,它会显示 0 个表,除非我运行 SHOW TABLES;在 SQL 选项卡中;

I have a database called apsc and if I run SHOW TABLES; on it, these are the results:

mysql> show tables;
+------------------------------------+
| Tables_in_apsc                     |
+------------------------------------+
| aps_application                    |
| aps_application_backup             |
| aps_application_resource           |
| aps_package                        |
| aps_package_configuration          |
| aps_package_global_setting         |
| aps_package_resource_configuration |
| aps_package_resource_setting       |
| aps_package_series                 |
| aps_package_service                |
| aps_registry_object                |
| aps_registry_object_setting        |
| aps_registry_object_tag            |
| aps_resource                       |
| aps_resource_backup                |
| aps_resource_requirement           |
| aps_resource_requirement_backup    |
| aps_settings_sequenses             |
+------------------------------------+
18 rows in set (0.00 sec)

However, if I run SELECT * FROM aps_application I get this:

mysql> SELECT * FROM aps_application;
ERROR 1146 (42S02): Table 'apsc.aps_application' doesn't exist

In my /var/lib/mysql/apsc/ directory are a bunch of .frm files which leads me to believe these tables are InnoDB. However, if they were merely corrupt or missing from the data/log files in /var/lib/mysql/apsc/ibdata1 they should show up as table in use or what not, as I've had that problem with other InnoDB tables recently.

I believe these tables are part of Plesk as I had overwritten by databases files at some point and received errors about a missing view aps_application. Plesk is working fine now, so I doubt the table is corrupt.

Also, SHOW CREATE TABLE aps_application and SHOW CREATE VIEW aps_application both fail with the same error as select.

Edit: I'm logged in as root with full permissions. To check this I switched tables and SELECT worked like a charm. Also, If I am in phpMyAdmin and select this database it shows 0 tables unless I run SHOW TABLES; in the SQL tab;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦幻之岛 2024-12-01 19:40:18

好的,这里是在黑暗中刺探,但是如果您完全限定表名怎么办?另外,尝试通过在名称后面添加“_”来更改表名称,然后看看是否可以选择它。

ok, stab in the dark here but what if you fully qualify the table name? also, try to change the table name by putting a '_' after the name and see if you can select it then.

岁月打碎记忆 2024-12-01 19:40:18

我有类似的问题。就我而言,这是区分大小写的。 select * from usersselect * from USERS 不同。因此,也许您可​​以尝试使用大写的表名或创建它时使用的大小写。

I had a similar issue. In my case it was the case sensitivity. select * from users is different from select * from USERS. So maybe you can try using the table name in upper case or the casing it was created with.

皓月长歌 2024-12-01 19:40:18

原来它们不是桌子,我从来没有真正弄清楚它们是什么:(

Turns out they weren't tables, and I never actually figured out what they are :(

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文