本文介绍了无法删除表,因为未知表(错误 1051)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从我继承的架构中删除一个表.当我 SHOW TABLES 我得到

+----------------------------+|表_in_schema_a |+------------------------------------+|表_1 ||表_2 ||表_3 ||表_4 ||表_5 ||表_6 |+------------------------------------+

但是当我执行 DROP TABLE table_1 我得到

错误 1051 (42S02):未知表table_1"

我正在使用正确的架构.怎么回事?

附言这是 MySQL 服务器是 5.1.73.

解决方案

结果 SHOW TABLES 实际上有点用词不当.那个表 table_1 是未知的,因为它实际上是一个视图.我运行 SELECT table_name, table_type FROM information_schema.tables WHERE table_schema='schema_a' 表明它是一个视图.DROP VIEW table_1 删除了它.

I'm trying to drop a table from a schema I inherited. When I SHOW TABLES I get

+----------------------------+
| Tables_in_schema_a         |
+----------------------------+
| table_1                    |
| table_2                    |
| table_3                    |
| table_4                    |
| table_5                    |
| table_6                    |
+----------------------------+

But when I execute DROP TABLE table_1 I get

I'm using the correct schema. What's going on?

P.S. This is MySQL server is 5.1.73.

解决方案

Turns out SHOW TABLES is actually a bit of a misnomer. That table, table_1, was unknown because it's actually a view. I ran SELECT table_name, table_type FROM information_schema.tables WHERE table_schema='schema_a' showed that it's a view. DROP VIEW table_1 deleted it.

这篇关于无法删除表,因为未知表(错误 1051)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 18:01