Mysql错误问题:ERROR 1005 (HY000): Can't create table 'crm_1.tbl_client' (errno: 150)

MySQL外键创建条件:

1.两个表必须是InnoDB数据引擎
2.外键表的外键字段必须是主键
3.字段类型必须一致

创建表时创建外键:

 create table tbl_client(userName varchar(255) not null, address varchar(255), createDate timestamp not null default now(), createUserName varchar(255), foreign key(createUserName) references tbl_user(userName));

原文地址:https://www.cnblogs.com/djoker/p/6685583.html