I think that the default storage is set to MyIsam, not InnoDb, and the table is created as MyIsam, not Innodb.
Foreign keys are only supported by Innodb tables.
For MyIsam tables, foreign key constraints are not supported, and while creating the table with create table
command, a foreign key specification is parsed, but it is ignored.
Try to set innodb
as a default engine using SET storage_engine=innodb;
, or create a table using explicitely Innodb like this:
create table t(id int, FOREIGN KEY (id) REFERENCES x(id)) engine=innodb;