Ask the Expert

MyISAM and foreign key support

Are foreign key constraints supported in MyISAM of MySQL? I have created a table using InnoDB, declaring the foreign key, and now I want to convert that table to MyISAM. Is it possible, and if so, how can I do it?

Requires Free Membership to View

While FOREIGN KEY constraints are on the to-do list of features to be added to the MyISAM table handler, they are not yet implemented and may not be for some time. In the meantime you may find InnoDB to be a fine table handler for most purposes, but if you absolutely must move the table to MyISAM then you will lose the ability to enforce foreign keys.

To convert a table to a different table handler, the following syntax can be used:

ALTER TABLE tablename TYPE = MyISAM;


This was first published in October 2004

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: