When I try to create a table with the following definition,
CREATE TABLE `demo` (
`id` INT(11) NOT NULL auto_increment,
`x_id` INT(11) NOT NULL,
`y_id` INT(11) NOT NULL,
`z_id` INT(11) NOT NULL,
`status` TINYINT unsigned NOT NULL,
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
CONSTRAINT UNIQUE INDEX(x_id, y_id)
) ENGINE=InnoDB;
an OperationalError
occurs:
_mysql_exceptions.OperationalError:
(1005, "Can't create table 'xxx.frm' (errno: -1)")
It works if I remove the trailing ENGINE=InnoDB
.
What is the reason behind this?
The MySQL version is
mysql Ver 14.12 Distrib 5.0.84, for pc-linux-gnu (i686) using readline 5.2
Please try this:
Foreign Key Constraints - Error 1005