First create the index and second the foreign key constraint. MySQL needs an index to create the foreign key, that's why you have to create the index first. Use seperate statements as well.
Frank Heikens
2010-08-11 06:32:02