2 messages in com.mysql.lists.win32ERROR 1005: Can't create table [forei...
FromSent OnAttachments
Juan Alvarado08 Mar 2004 18:49 
Juan Alvarado09 Mar 2004 04:26 
Subject:ERROR 1005: Can't create table [foreign keys] - URGENT
From:Juan Alvarado (juan@yahoo.com)
Date:03/09/2004 04:26:42 AM
List:com.mysql.lists.win32

Hello sorry for the repost, but this is an extremely urgent matter for us and I just wanted to give it one more try.

I know the list is full of posts like this one. However after spending about an hour reading through most of them, I'm still having problems with foreign keys.

My show create table command ouputs the following: CREATE TABLE `ap_step` ( `ap_step_id` int(11) NOT NULL auto_increment, `ap_step` varchar(255) NOT NULL default '', `tech_id` int(11) NOT NULL default '0', `ap_detail_level_id` tinyint(4) default NULL, `ap_type_id` int(11) default NULL, `ap_step_category_id` int(11) NOT NULL default '0', PRIMARY KEY (`ap_step_id`), KEY `tech_id` (`tech_id`), KEY `ap_detail_level_id` (`ap_detail_level_id`), KEY `ap_type_id` (`ap_type_id`), KEY `ap_step_category_id` (`ap_step_category_id`), CONSTRAINT `0_157` FOREIGN KEY (`ap_type_id`) REFERENCES `ap_type` (`ap_type_id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `0_158` FOREIGN KEY (`tech_id`) REFERENCES `technology` (`tech_id`), CONSTRAINT `0_159` FOREIGN KEY (`ap_detail_level_id`) REFERENCES `ap_detail_level` (`level_id`) ON DELETE CASCADE ON UPDATE CASCADE ) TYPE=InnoDB

my alter table is the following:

alter table ap_step add constraint FK_ap_step_category foreign key (ap_step_category_id) references ap_step_category(ap_step_category_id) on delete cascade on update cascade

and the error I get is what you see in the subject of this email. I have the key created in the table for my foreign key, so I don't know what else I can do.

I would prefer to resolve this issue via the alter command because mysqldump is too much of a pain.

Any help is greatly appreciated.