zoukankan      html  css  js  c++  java
  • 使用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 table already exists in the InnoDB internal data dictionary, though the .frm file for the table has been deleted. This is the
    most common reason for getting errno 121 in table creation. Another possible reason is a name conflict in a foreign key constraint name. Constraint names must be unique in a database, like table names are.

    意思是:

    1、表名重复

    2、以该名字命名的表之前创建过后来删除了,但是对应的.frm文件还留在磁盘上

    3、主键名字在全数据库范围内不是唯一的

    今天遇到的应该是第三种情况-----主键名字在全数据库范围内不是唯一的

    在设置外键的时候,外键名之前在另外一张表里面已经使用过,这就造成了'121'这个错误。将外键名进行更改后,建表成功。

  • 相关阅读:
    PHP类(一)-类的实例化
    PHP函数(六)-匿名函数(闭包函数)
    PHP函数(五)-回调函数
    javaIO-字符流
    split 命令
    hadoop的增删改查
    Hadoop的MR
    java的序列化和反序列化
    字符串格式化-String类format方法
    Avro从入门到入土
  • 原文地址:https://www.cnblogs.com/wxb20/p/6099367.html
Copyright © 2011-2022 走看看