[英]Mysql can't create table errno 121
为什么会出现此错误? 我没有任何外键
drop table if exists t_issue;
SET foreign_key_checks = 0;SET storage_engine=INNODB;
CREATE TABLE `t_issue` (
`id_issue` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`fk_project` int(11) DEFAULT NULL,
`subject` varchar(255) DEFAULT NULL,
`estimated_due_date` date DEFAULT NULL,
`due_date` date DEFAULT NULL,
`done_ratio` int(11) DEFAULT NULL,
`fk_status` int(11) DEFAULT NULL,
`fk_assigned_to` int(11) DEFAULT NULL,
`fk_owner` int(11) DEFAULT NULL
) ENGINE=innodb DEFAULT CHARSET=latin1
如果您尝试添加名称已经在其他地方使用的约束,则会收到此消息。
要检查约束,请使用以下SQL查询:
SELECT
constraint_name,
table_name
FROM
information_schema.table_constraints
WHERE
constraint_type = 'FOREIGN KEY'
AND table_schema = DATABASE()
ORDER BY
constraint_name;
参考: https : //dba.stackexchange.com/questions/425/error-creating-foreign-key-from-mysql-workbench
另请参阅: SQL-错误代码1005,错误号为121
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.