运行alter操作,

alter table xx_shop_info add index FK9050F5D83304CDDC (shop_area), add constraint FK9050F5D83304CDDC foreign key (shop_area) references xx_shop_area (id)

出现下面的错误

Error : Can't create table 'moshop_1.#sql-534_185' (errno: 150)

找了好多原因,总结能够列举例如以下,我的犯错的是5

1、外键的引用类型不一样,主键是int外键是char

2、找不到主表中 引用的列

3、主键和外键的字符编码不一致 

4、还有要建立外键的话,要先建立索引。没有建立索引也会出错。

5、还有可能是是标的Table Type 不正确,例如以下的InnoDB 和MyISAM的错误

【Bug Fix】Error : Can't create table 'moshop_1.#sql-534_185' (errno: 150)的更多相关文章

  1. 【MySQL】ERROR 1005: Can't create table (errno: 150)的错误解决办法

    在mysql 中建立引用约束的时候会出现MySQL ERROR 1005: Can't create table (errno: 150)的错误信息结果是不能建立 引用约束. 出现问题的大致情况 1. ...

  2. MySQL ERROR 1005: Can't create table (errno: 150)的错误解决办法

    在mysql 中建立引用约束的时候会出现MySQL ERROR 1005: Can't create table (errno: 150)的错误信息结果是不能建立 引用约束. 出现问题的大致情况 1. ...

  3. 使用Navicat V8.0创建数据库,外键出现错误ERROR 1005: Can’t create table (errno: 121)

    ERROR 1005: Can't create table (errno: 121) errno 121 means a duplicate key error. Probably the tabl ...

  4. 【MySQL案件】ERROR 1665 (HY000)

    转载请注明: http://blog.csdn.net/jason_asia/article/details/36240815 1.1.1. ERROR 1665 (HY000) [环境的叙述性说明] ...

  5. 【MySQL案件】ERROR 1418

    1.1.1. ERROR 1418 [环境的叙述性说明] mysql5.0.67 [问题叙述性说明] 当它来到创建存储过程ERROR 1418一个错误. # 创建函数SQL声明 CREATE FUNC ...

  6. 【MySQL案例】error.log的Warning:If a crash happens thisconfiguration does not guarantee that the relay lo(转)

    标签: 1.1.1. If a crash happens thisconfiguration does not guarantee that the relay log info will be c ...

  7. 【MySQL案例】ERROR 1786 (HY000)

    1.1.1. ERROR 1786 (HY000) [环境描写叙述] msyql5.6.14 [报错信息] 运行create table ... select的时候遇到报错: db1 [test] [ ...

  8. 【MySQL案例】error.log的Warning:If a crash happens thisconfiguration does not guarantee that the relay lo

    1.1.1. If a crash happens thisconfiguration does not guarantee that the relay log info will be consi ...

  9. 【bug解决】ios微信浏览器中背景音乐无法播放

    我记得之前在一次项目中,出现过浏览报错: 当时的文档链接如右:[解决]HTML5新标签audio的autoplay自动播放属性失效的解决方案 所以在这次H5的制作中,我使用了iframe来加载音频文件 ...

随机推荐

  1. php的var关键字

    public和var的作用差不多 因为 var定义的变量如果没有加protected 或 private则默认为public php4 中一般是用 varphp5 中就一般是用 public了 现在基 ...

  2. linux脚本:shell, 判断输入参数的个数(命令行)

    if [ $# != 3 ] ; thenecho "USAGE: $0 from to"echo " e.g.: $0 ~/oucaijun/from ~/oucaij ...

  3. Mac 实用工具

    命令行常用工具: Iterm2 也是一个终端命令行工具,支持多工作区,使用清爽 http://www.iterm2.com/documentation.html 给你的命令行 代码上色 Solariz ...

  4. Delphi中MethodAddress汇编代码的解析

    class function TObject.MethodAddress(const Name: ShortString): Pointer;asm        { ->    EAX     ...

  5. Unity3D NGUI,uGUI总结

    跪求官方UI系统(2014年11月底已出,用原生的比用NGUI放心) uGUI注意点 1.要防止多个canvas叠加点击穿透,canvas里面的graphics raycaster调整到恰当选项 2. ...

  6. C keyword register 并讨论共同使用嵌入式汇编

    C keyword register 并讨论共同使用嵌入式汇编 register 是C99 的keyword之中的一个. register 是储存类型之中的一个.这里仅讨论register 储存类型. ...

  7. Python unittest 官方文档

    https://docs.python.org/2/library/unittest.html#

  8. 2015 Multi-University Training Contest 1

    最近真是太废柴了,题没做几道,也没学什么新知识,多校做了三场也没总结~诶!好好学吧! 多校第一场感觉被完虐...orz... Hdu 5288 OO’s Sequence 题目链接:http://ac ...

  9. iot 表主键存放所有数据,且按数据插入顺序排序

    iot表测试: 在create table语句后面使用organization index,就指定数据表创建结构是IOT.但是在不指定主键Primary Key的情况下,是不允许建表的. create ...

  10. AES加密例子(python和php版本)

    AES加密例子(python和php版本) AES加密例子(python和php版本)