Tuesday, February 10, 2009

How to create foreign key in mysql (InnoDB)

Yes you can definitely create foreign key constraints on mysql. but it can only be enforced in InnoDB storage engine. The default storage engine is MyISAM, you cannot create foreign key constraints in MyISAM. So make sure you create your tables using InnoDB storage engine.
If you are using a phpMyAdmin to work with mysql, look at the following ScreenShot.



Remember, before making a column available for referencing you should make sure that child column has a Index.





Now using Relation view link you can easily create foreign key constraints



No comments:

Post a Comment