MySQL: Can't create table (errno: 150)

后端 未结 30 3224
误落风尘
误落风尘 2020-11-22 06:48

I am trying to import a .sql file and its failing on creating tables.

Here\'s the query that fails:

CREATE TABLE `data` (
`id` int(10) unsigned NOT NUL         


        
30条回答
  •  被撕碎了的回忆
    2020-11-22 07:26

    I think all these answers while correct are misleading to the question.

    The actual answer is this before you start a restore, if you're restoring a dump file with foreign keys:

    SET FOREIGN_KEY_CHECKS=0;
    

    because naturally the restore will be creating some constraints before the foreign table even exists.

提交回复
热议问题