MySQL Error Solution: Can’t create table ‘tablename’ (errno: 150)

MySQL error: Can’t create table ‘tablename’ (errno: 150) can occur when you, for example, upload a backup and MySQL is powered to create table 1 which refers to table 2, which essentially does not exist yet. You can solve by inserting the lines at the beginning in the backup:

SET FOREIGN_KEY_CHECKS = 0;

And at the very end:

SET FOREIGN_KEY_CHECKS = 1;

See my other MySQL related articles

Leave a comment

Leave a Reply