Mysql: adding foreign key does not give warning/error on MyISAM tables

。_饼干妹妹 提交于 2019-11-29 11:14:39

myISAM doesn't do referential integrity. it seems it is legal to add such constraints and hence no error, though the constraints won't be enforced as long as the engine is myISAM. It does store the keys created so the user can see what was intended, though.

The InnoDB engine should generally (unless you have a fulltext index for instance) be preferred, as InnoDB allows transactions, foreign keys, and row locking, for instance.

On a test database, perform

  ALTER TABLE notes ENGINE = InnoDB;
  ALTER TABLE notetypes ENGINE = InnoDB;

(and any other relevant - maybe all - tables)

and ensure you do not have any side effects (See Mysql Alter Table).

Check also the parameters specific to InnoDB (in my.sql), See also the Mysql InnoDB engine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!