SET foreign_key_checks = 0; CREATE TABLE user_to_account ( account_id int(11) DEFAULT NULL, user_id int(11) DEFAULT NULL, KEY user_to_account_account_account_id_fk (account_id), KEY user_to_account_user_user_id_fk (user_id), CONSTRAINT user_to_account_account_account_id_fk FOREIGN KEY (account_id) REFERENCES account (account_id), CONSTRAINT user_to_account_user_user_id_fk FOREIGN KEY (user_id) REFERENCES user (user_id) ) engine = InnoDB; SET foreign_key_checks = 1;