MySQL ERROR 1005: Can’t create table (errno: 150) [How to Solve]

When creating a reference constraint in mysql, the error message MySQL error 1005: can’t create table (errno: 150) will appear. As a result, the reference constraint cannot be created

General situation of the problem:

The reference types of foreign keys are different. For example, the primary key is int and the foreign key is char

The column referenced in the main table could not be found

The character encoding of primary key and foreign key is inconsistent, and the storage engine may be different

Similar Posts: