DROP TABLE IF EXISTS dbmail_envelope; CREATE TABLE dbmail_envelope ( physmessage_id BIGINT NOT NULL, id BIGINT NOT NULL AUTO_INCREMENT, envelope TEXT NOT NULL, PRIMARY KEY (id), UNIQUE (physmessage_id, id), FOREIGN KEY (physmessage_id) REFERENCES dbmail_physmessage(id) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'REFERENCES dbmail_physmessage(id) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=' at line 7