I am trying to create a table in MySQL with two foreign keys, which reference the primary keys in 2 other tables, but I am getting an errno: 150 error and it will not create
As pointed by @andrewdotn the best way is to see the detailed error(SHOW ENGINE INNODB STATUS;
) instead of just an error code.
One of the reasons could be that an index already exists with the same name, may be in another table. As a practice, I recommend prefixing table name before the index name to avoid such collisions. e.g. instead of idx_userId
use idx_userActionMapping_userId
.