1051: Unknown table 'x'(未知表 'x')
MySQL含义
所引用的表不存在。在删除、修改或查询时找不到给定名称的表。
原因
表名拼写错误;表从未创建或已被删除;选择了错误的数据库(schema);大小写敏感(Linux 上表名区分大小写);对不存在的表执行 DROP TABLE。
解决方法
列出现有表:SHOW TABLES; 并选择正确的数据库:USE mydb; 修正表名及其大小写。为避免删除时报错:DROP TABLE IF EXISTS my_table; 如果位于其他 schema,用 schema.table 限定。
同一数据库的其他条目
- 1406Data too long for column(列的数据过长)
- 1071Specified key was too long; max key length is 767 bytes(指定的键过长;最大键长度为 767 字节)
- 1050Table already exists(表已存在)
- 1091Can't DROP 'x'; check that column/key exists(无法 DROP 'x';请检查该列/键是否存在)
- 1093You can't specify target table 'x' for update in FROM clause(不能在 FROM 子句中指定要更新的目标表 'x')
- 1305PROCEDURE does not exist(PROCEDURE 不存在)
- 1227Access denied; you need (at least one of) the PRIVILEGE(访问被拒绝;需要(至少一项)PRIVILEGE 权限)