我想用放弃一些外国键外键错误:的MySQL降152
ALTER TABLE `table` DROP FOREIGN KEY `fk_table_users1` , DROP FOREIGN KEY `fk_table_accounts1` , DROP FOREIGN KEY `fk_table_data1` ;
但它返回的错误:
Error on rename of './db/table' to './db/#sql2-179c-288289' (errno: 152)
我已经运行SHOW ENGINE INNODB STATUS
它说:
120725 12:38:37 Error in dropping of a foreign key constraint of table db/table,
in SQL command
ALTER TABLE `table` DROP FOREIGN KEY `fk_table_users1` , DROP FOREIGN KEY `fk_table_accounts1` , DROP FOREIGN KEY `fk_table_data1`
Cannot find a constraint with the given id fk_table_users1.
SHOW CREATE TABLE 'table'
输出:
CREATE TABLE `table` (
`id` int(11) NOT NULL auto_increment,
`data_id` int(11) NOT NULL,
`account_id` int(11) NOT NULL,
`status` enum('pending','complete') NOT NULL default 'pending',
`created_at` datetime NOT NULL,
`created_by` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_orders_users1` (`created_by`),
KEY `fk_orders_data1` (`data_id`),
KEY `fk_orders_accounts1` (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
但是,当我通过phpmyadmin查看结构时,它列出了具有相同名称的外键。在我可以放弃外键之前,我是否需要做其他事情?
请寄出SHOW CREATE TABLE'table'的输出;''。 – eggyal 2012-07-25 12:09:09
@eggyal编辑我的帖子与输出 – xylar 2012-07-25 12:14:38
我没有看到*任何*外键约束那里... – eggyal 2012-07-25 12:20:35