MYSQL Error1005(HY000):无法创建表(错误:121“写入或更新时重复键”)

时间:2022-09-19 20:39:06

I was doing my mysql assignment in XAMPP,but kept getting

我在XAMPP中进行了我的mysql任务,但一直在进行

Error1005(HY000): Can't create table (errno: 121 "Duplicate key on write or update") And when I changed 'Course' to 'Courses' , It worked! Got the same error with 'Instructor', And it worked when I changed the tablename from 'Instructor' to 'Faculty'. See Images below for clarification. I really want to know what's happening under the hood! MYSQL Error1005(HY000):无法创建表(错误:121“写入或更新时重复键”)MYSQL Error1005(HY000):无法创建表(错误:121“写入或更新时重复键”)

Error1005(HY000):无法创建表(错误:121“写入或更新时重复键”)当我将“课程”更改为“课程”时,它有效!与'讲师'有同样的错误,当我将表名从'讲师'改为'教师'时,它有效。请参阅下面的图片以获得说明。我真的想知道引擎盖下发生了什么!

1 个解决方案

#1


0  

I think, mostly, you missed the constraint name like this CONSTRAINT fk_book_author.

我认为,大多数情况下,你错过了像CONSTRAINT fk_book_author这样的约束名称。

You also missed TABLE keyword in the first screen, last query.

您还在第一个屏幕,最后一个查询中错过了TABLE关键字。

#1


0  

I think, mostly, you missed the constraint name like this CONSTRAINT fk_book_author.

我认为,大多数情况下,你错过了像CONSTRAINT fk_book_author这样的约束名称。

You also missed TABLE keyword in the first screen, last query.

您还在第一个屏幕,最后一个查询中错过了TABLE关键字。