且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

#1072 关键列不存在错误与 MySQL 外键

更新时间:2022-02-28 04:19:02

您正在 hobbies 中的 user_id 列上设置 PRIMARY KEY,但没有这样的列.它被称为hobby_user_id.

You are setting a PRIMARY KEY on a column user_id in hobbies, but there is no such column. It is called hobby_user_id.

 PRIMARY KEY (`hobby_user_id`) ,

在我自己的数据库中进行的快速测试成功创建了这两个具有正确PRIMARY KEY 规范的表.

A quick test in my own database successfully creates these two tables with the correct PRIMARY KEY spec.