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

后端 未结 30 2686
误落风尘
误落风尘 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

    If the PK table is created in one CHARSET and then you create FK table in another CHARSET..then also you might get this error...I too got this error but after changing the charset to PK charset then it got executed without errors

    create table users
    (
    ------------
    -------------
    )DEFAULT CHARSET=latin1;
    
    
    create table Emp
    (
    ---------
    ---------
    ---------
    FOREIGN KEY (userid) REFERENCES users(id) on update cascade on delete cascade)ENGINE=InnoDB, DEFAULT CHARSET=latin1;
    

提交回复
热议问题