简体   繁体   English

没有外键不能创建表errno:150 MYSQL

[英]can't create a table without foreign key errno:150 MYSQL

我有一个具有外键约束的表“供应商”,删除了它,现在我想重新创建一个完全没有外键的表,但是我遇到的经典错误是150,任何想法都可以做。 -创建此表。

In the file that the SQL is dumped in and that you are loading to recreate the database, add SET FOREIGN_KEY_CHECKS = 0 ; 在转储了SQL并要重新创建数据库的加载文件中,添加SET FOREIGN_KEY_CHECKS = 0 ; at the start and SET FOREIGN_KEY_CHECKS = 1 at the end 在开始处, SET FOREIGN_KEY_CHECKS = 1

It seems that there is an inconsistency there, as creating a table without constraints should be possible at any time. 似乎存在不一致之处,因为应该可以随时创建无约束的表。 From the Mysql Manual , what you should do is run Mysql Manual中 ,应执行的操作

SHOW ENGINE INNODB STATUS.

or 要么

SHOW ERRORS

to check the detail of the error you are getting. 检查您得到的错误的详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM